Ejemplo n.º 1
0
		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;
					}
			}
		}
Ejemplo n.º 2
0
		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();
		}