示例#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);
 }