龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > asp.net编程 >

Silverlight游戏编程:使用Silverlight 3.0实现贪吃蛇游戏(c#)(4)

时间:2009-12-21 11:47来源:未知 作者:admin 点击:
分享到:
#region 属性 public DirectionMoveDirection { set { Bodyhead = _bodies.First().Key; if (head.MoveDirection == Direction.Up value == Direction.Down) return ; if (head.MoveDirection == Direction.Down v

        #region 属性
        
public Direction MoveDirection
        {
            
set
            {
                Body head 
= _bodies.First().Key;

                
if (head.MoveDirection == Direction.Up && value == Direction.Down)
                    
return;
                
if (head.MoveDirection == Direction.Down && value == Direction.Up)
                    
return;
                
if (head.MoveDirection == Direction.Left && value == Direction.Right)
                    
return;
                
if (head.MoveDirection == Direction.Right && value == Direction.Left)
                    
return;

                _moveDirection 
= value;
            }
        }

        
public bool Enabled
        {
            
get { return _enabled; }
            
set { _enabled = value; }
        }

        
public double Speed
        {
            
get { return _speed; }
            
set { _speed = value; }
        }

        
public int AteCapacity
        {
            
get { return _ateCapacity; }
            
set { _ateCapacity = value; }
        }
        
#endregion

        
#region 事件 GameOver 和 Ate
        
public event EventHandler GameOver;

        
public event EventHandler Ate;
        
#endregion
    }
}
[源码下载]


精彩图集

赞助商链接