Ejemplo n.º 1
0
        private static Vector2 PositionOf(RtsGameObject target)
        {
            if (target is Building)
            {
                return(((Building)target).Size / 2 + target.Position);
            }

            return(target.Position);
        }
Ejemplo n.º 2
0
        private float DistanceTo(RtsGameObject target)
        {
            if (target is Building)
            {
                var p  = PositionOf(target);
                var s  = ((Building)target).Size;
                var dx = Math.Max(Math.Abs(Position.x - p.x) - s.x / 2, 0);
                var dy = Math.Max(Math.Abs(Position.y - p.y) - s.y / 2, 0);

                return(dx * dx + dy * dy);
            }

            return(Vector2.Distance(Position, PositionOf(target)));
        }
Ejemplo n.º 3
0
 public AttackOrder(WarriorUnit unit, RtsGameObject target)
 {
     mUnit   = unit;
     mTarget = target;
 }