示例#1
0
        public GameObject(Map map, int id, float x, float y, int collisionRadius, int visionRadius = 0) : base(x, y)
        {
            this.map = map;
            this.id = id;
            this.target = null;
            this.collisionRadius = collisionRadius;
            this.visionRadius = visionRadius;
            this.team = 0;
            this.movementUpdated = false;
            this.toRemove = false;
            this.attackerCount = 0;
            this.dashing = false;
            this.visibleByTeam = new bool[] { false, false, false };

        }
示例#2
0
        public Projectile(Map map, int id, float x, float y, int collisionRadius, Unit owner, Target target, Spell originSpell, float moveSpeed, int projectileId, int flags = 0) : base(map, id, x, y, collisionRadius)
        {
            this.originSpell = originSpell;
            this.moveSpeed = moveSpeed;
            this.owner = owner;
            this.projectileId = projectileId;
            this.flags = flags;

            setTarget(target);

            if (!target.isSimpleTarget())
                ((GameObject)target).incrementAttackerCount();

            owner.incrementAttackerCount();
        }
示例#3
0
 public float distanceWithSqr(Target target)
 {
     return distanceWithSqr(target.getX(), target.getY());
 }
示例#4
0
        public virtual void refreshWaypoints()
        {
            if (targetUnit == null || (distanceWith(targetUnit) <= stats.getRange() && waypoints.Count == 1))
                return;

            if (distanceWith(targetUnit) <= stats.getRange() - 2.0f)
            {
                setWaypoints(new List<Vector2> { new Vector2(x, y) });
            }
            else
            {
                Target t = new Target(waypoints[waypoints.Count - 1]);
                if (t.distanceWith(targetUnit) >= 25.0f)
                {
                    setWaypoints(new List<Vector2> { new Vector2(x, y), new Vector2(targetUnit.getX(), targetUnit.getY()) });
                }
            }
        }
示例#5
0
        public void setTarget(Target target)
        {
            if (this.target == target)
                return;

            this.target = target;
        }