protected override void OnLocationChange(Point3D oldLoc) { if( Cannon == null ) { Cannon = new CannonSouth(this); Direction = Direction.South; Cannon.MoveToWorld( new Point3D(X,Y + 1,Z), Map); } else { Direction = Direction.South; Cannon.MoveToWorld( new Point3D(X,Y + 1,Z), Map); } base.OnLocationChange(oldLoc); }
public override void OnThink() { if( Combatant == null ) return; Direction d = this.GetDirectionTo(Combatant); if( Direction != d ) Direction = d; if( Cannon.Direction != Direction ) { switch (Direction) { case Direction.Up: case Direction.North: { Cannon.Delete(); Cannon = new CannonNorth(this); Cannon.MoveToWorld( new Point3D(X,Y - 3,Z), Map); Cannon.Direction = Direction; break; } case Direction.Down: case Direction.South: { Cannon.Delete(); Cannon = new CannonSouth(this); Cannon.MoveToWorld( new Point3D(X,Y + 1,Z), Map); Cannon.Direction = Direction; break; } case Direction.Right: case Direction.East: { Cannon.Delete(); Cannon = new CannonEast(this); Cannon.MoveToWorld( new Point3D(X + 1,Y,Z), Map); Cannon.Direction = Direction; break; } case Direction.Left: case Direction.West: { Cannon.Delete(); Cannon = new CannonWest(this); Cannon.MoveToWorld( new Point3D(X - 3,Y,Z), Map); Cannon.Direction = Direction; break; } } } base.OnThink(); }
public void GetDirection() { switch (Direction) { case Direction.Up: case Direction.North: { Cannon.Delete(); Cannon = new CannonNorth(this); Cannon.MoveToWorld( new Point3D(X,Y - 3,Z), Map); Cannon.Direction = Direction; break; } case Direction.Down: case Direction.South: { Cannon.Delete(); Cannon = new CannonSouth(this); Cannon.MoveToWorld( new Point3D(X,Y + 1,Z), Map); Cannon.Direction = Direction; break; } case Direction.Right: case Direction.East: { Cannon.Delete(); Cannon = new CannonEast(this); Cannon.MoveToWorld( new Point3D(X + 1,Y,Z), Map); Cannon.Direction = Direction; break; } case Direction.Left: case Direction.West: { Cannon.Delete(); Cannon = new CannonWest(this); Cannon.MoveToWorld( new Point3D(X - 3,Y,Z), Map); Cannon.Direction = Direction; break; } } }