示例#1
0
 public bool IsChildOf(Unit unitToCheck)
 {
     return unitToCheck == parent;
 }
 public void UpdateUnit(Unit unit)
 {
     int X = GetLogicCoo(unit.position.X);
     int Y = GetLogicCoo(unit.position.Y);
     int oldX, oldY;
     ArrayList node = gameObjects[X, Y];
     unit.GetLogicCoo(out oldX, out oldY);
     gameObjects[oldX, oldY].Remove(unit);
     if (!node.Contains(unit))
     {
         node.Add(unit);
         unit.SetLogicCoo(X, Y);
     }
 }
示例#3
0
 public Shot(GameVector Pos, GameVector Dir, float Damage, float LifeTime, Unit ParentUnit)
 {
     parent = ParentUnit;
     switch (parent.ShipType)
     {
         case ShipTypes.Destroyer:
             size = 24; break;
         case ShipTypes.Corvette:
             size = 48; break;
         case ShipTypes.Cruiser:
             size = 90; break;
         default: size = 1; break;
     }
     pos = Pos;
     PrevPos = pos;
     direction = Dir;
     damage = Damage;
     lifeTime = LifeTime;
     hitSomebody = false;
     forward = GameVector.Normalize(direction);
 }
 internal void RemoveUnit(Unit unit)
 {
     int X, Y;
     unit.GetLogicCoo(out X, out Y);
     gameObjects[X, Y].Remove(unit);
 }