foodmodel.java
来自「MVC设计模式早在面向对象语言Smalltalk-80中就被提出并在此后得到业界」· Java 代码 · 共 60 行
JAVA
60 行
/********************************************************************************************/
/* */
/* FoodModel.java */
/* */
/* 果实模型,这里只实现了最基本功能,有很大扩展空间 */
/* */
/* Programed by Luo Pengkui on 2004-9 */
/* */
/********************************************************************************************/
import java.awt.Point;
//------------------------------------ BEGIN ------------------------------------------------
public class FoodModel
{
private Point m_where; // 果实位置,参数传递时用Point类比直接用xy方便
private int m_life;
private int m_overTime;
private String m_state;
public FoodModel( )
{
m_life = 7; // 果实生命值
}
public int mb_getLife()
{
return m_life;
}
public void mb_setLife(int foodLife)
{
m_life = foodLife;
}
public int mb_getOverTime()
{
return m_overTime;
}
public void mb_setOverTime(int time)
{
m_overTime = time;
}
public Point mb_getPosition() // 获取果实当前位置
{
return m_where;
}
public void mb_setPosition(Point position) // 设置果实当前位置
{
m_where = position;
}
}
//------------------------------------- END -------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?