Beispiel #1
0
 /// <summary>
 /// Convert an Ice position object to it's equivalent 3D vector.
 /// </summary>
 /// <param name="point">Position to set.</param>
 public void SetPosition(VTankObject.Point point)
 {
     this.Position = new Vector3((float)point.x, (float)point.y, this.Position.Z);
     if (HealthBar != null)
     {
         HealthBar.Position = new Vector3((float)point.x, (float)point.y, this.Position.Z);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Tell the tank to set it's health to the maximum and to shift it's position.
        /// </summary>
        /// <param name="where">Position to respawn at.</param>
        public void Respawn(VTankObject.Point where)
        {
            Health = MaxHealth;
            if (HealthBar != null)
            {
                HealthBar.Health = MaxHealth;
            }
            else
            {
                // This player is the local player.
                // TODO: This is done as a temporary fix to the 'server doesn't know where you are' bug.
                ServiceManager.Theater.Move(where.x, where.y, Direction.NONE);
            }

            SetPosition(where);
            Alive   = true;
            elapsed = weapon.Cooldown;
        }
Beispiel #3
0
 /// <summary>
 /// Calculate the distance between two targets.
 /// </summary>
 /// <param name="p1"></param>
 /// <param name="p2"></param>
 /// <returns></returns>
 private double GetDistance(VTankObject.Point p1, VTankObject.Point p2)
 {
     return(Math.Sqrt(Math.Pow(p2.x - p1.x, 2) + Math.Pow(p2.y - p1.y, 2)));
 }