Пример #1
0
        private void AttackTarget()
        {
            Unit targetUnit = this.UnitsMap.Get(this.Target);

            if (targetUnit != null)
            {
                SimulateAttack(false, this.Target, this.DeltaHealth, this.Knockback, true);
                KnockbackHandler handler = new KnockbackHandler(this.UnitsMap);
                handler.Execute(this.BoardController, this.Unit.GetPosition(), targetUnit.GetPosition(), this.Knockback);
                targetUnit?.Health.ReduceHealth(this.DeltaHealth);
            }

            this.IsActive(false);
            Logcat.I(this, "Telekinesis blast executed");
        }
Пример #2
0
        public override void Execute()
        {
            Logcat.I(this, $"Nanobots called");

            Unit targetUnit = this.UnitsMap.Get(this.Target);

            SimulateAttack(false, this.Target, this.DeltaHealth, this.Knockback, false);
            KnockbackHandler handler = new KnockbackHandler(this.UnitsMap);

            handler.Execute(this.BoardController, this.Unit.GetPosition(), targetUnit.GetPosition(), this.Knockback);
            targetUnit.Health.IncreaseHealth(this.DeltaHealth);
            Logcat.I(this, $"Nanobots unit healed");

            this.IsActive(false);
        }
Пример #3
0
        private void OnCollisionEnter(Collision collision)
        {
            var go = collision.gameObject;

            if (_onSkill && go.CompareTag("Enemy"))
            {
                EnemyHealth      eh  = go.GetComponent <EnemyHealth>();
                KnockbackHandler kbh = go.GetComponent <KnockbackHandler>();
                kbh.HandleKnockBack(transform.position, _knockbackForce);
                eh.DealDamage(damage);

                if (_stopPlayerOnEnemyCollision)
                {
                    playerRb.velocity = Vector3.zero;
                }
            }
        }
Пример #4
0
        private void AttackPosition(Point target)
        {
            Unit targetUnit = this.Unit.UnitsMap.Get(target);

            if (targetUnit == null)
            {
                return;
            }

            if ((targetUnit is EnemyUnit) && ((EnemyUnit)targetUnit).GetSpawnedUnitType() == UnitType.NEOSATAN_LEG)
            {
                return;
            }

            KnockbackHandler handler = new KnockbackHandler(this.UnitsMap);

            handler.Execute(this.BoardController, this.Unit.GetPosition(), targetUnit.GetPosition(), this.Knockback);
            targetUnit?.Health.ReduceHealth(this.DeltaHealth);
            //// Logcat.I($"attacking position {target}, is a unit in the position? {targetUnit != null}");
        }
Пример #5
0
        public override void Execute()
        {
            if (!this.ValidateAction(this.Target))
            {
                return;
            }

            Unit targetUnit = this.UnitsMap.Get(this.Target);

            if (targetUnit != null)
            {
                SimulateAttack(false, this.Target, this.DeltaHealth, this.Knockback, true);
                KnockbackHandler handler = new KnockbackHandler(this.UnitsMap);
                handler.Execute(this.BoardController, this.Unit.GetPosition(), targetUnit.GetPosition(), this.Knockback);
                targetUnit?.Health.ReduceHealth(this.DeltaHealth);
            }

            this.IsActive(false);
            Logcat.I(this, "Crush Action executed");
        }
Пример #6
0
 private void Start()
 {
     handler = new KnockbackHandler(map);
 }
Пример #7
0
 private void OnEnable()
 {
     unit    = GetComponent <Unit>();
     handler = new KnockbackHandler(unit.UnitsMap);
     Selector.CancelledAction += OnActionCancelled;
 }
Пример #8
0
 private void PullUnit(KnockbackHandler handler, Unit enemyUnit)
 {
     handler.InverseKnockback(this.BoardController, this.Unit.GetPosition(), enemyUnit.GetPosition(), this.Knockback);
 }