Exemple #1
0
        public Projectile(Unit parent, Unit target, DamageEvent.DamageType type, float movementSpeed, int maxRange, int baseDamage)
        {
            this.parent = (Bowman)parent;
            this.x = parent.x;
            this.y = parent.y;
            this.startX = this.x;
            this.startY = this.y;

            this.target = target;
            this.type = type;
            this.movementSpeed = movementSpeed;
            this.maxRange = maxRange;
            this.baseDamage = baseDamage;

            this.waypoint = Util.GetPointOnCircle(parent.GetLocation(), maxRange,
                Util.GetHypoteneuseAngleDegrees(parent.GetLocation(), target.GetLocation()));

            int targetX = (int)target.x;
            int targetY = (int)target.y;

            SetMoveToTarget(targetX, targetY);

            if (Game1.GetInstance().IsMultiplayerGame())
            {
                Boolean isLocal = this.parent.player == Game1.CURRENT_PLAYER;
                this.multiplayerData = new ProjectileMultiplayerData(this, isLocal);
                if (isLocal)
                {
                    this.multiplayerData.RequestServerID();
                }
            }
        }
Exemple #2
0
        public Projectile(CombatUnit parent, Unit target, DamageEvent.DamageType type, float movementSpeed, int maxRange, int baseDamage)
        {
            this.parent = parent;
            this.x = parent.x;
            this.y = parent.y;
            this.startX = this.x;
            this.startY = this.y;

            this.target = target;
            this.type = type;
            this.movementSpeed = movementSpeed;
            this.maxRange = maxRange;
            this.baseDamage = baseDamage;

            this.waypoint = Util.GetPointOnCircle(parent.GetLocation(), maxRange,
                Util.GetHypoteneuseAngleDegrees(parent.GetLocation(), target.GetLocation()));

            int targetX = (int)target.x;
            int targetY = (int)target.y;

            SetMoveToTarget(targetX, targetY);
        }