Exemplo n.º 1
0
		protected override void OnLocationChange(Point3D oldLoc)
		{
			if( Cannon == null )
			{
				Cannon = new CannonNorth(this);
				Direction = Direction.North;
				Cannon.MoveToWorld( new Point3D(X,Y - 3,Z), Map);
			}
			else
			{
				Direction = Direction.North;
				Cannon.MoveToWorld( new Point3D(X,Y - 3,Z), Map);
			}
			base.OnLocationChange(oldLoc);
		}
Exemplo n.º 2
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;
					}
			}
		}
Exemplo n.º 3
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();
		}