コード例 #1
0
    private void OnTriggerStay(Collider other)
    {
        SlowDebuff slowDebuff = other.gameObject.GetComponent <SlowDebuff>();

        if (slowDebuff == null)
        {
            slowDebuff = (SlowDebuff)other.gameObject.AddComponent(typeof(SlowDebuff));
        }
        slowDebuff.ResetDebuff(_slowDuration, _slowAmount);
    }
コード例 #2
0
ファイル: Enemy.cs プロジェクト: dmitrycdz/LaboratoryDefense
 void TakeSlowDamage()
 {
     if (slowDebuff != null)
     {
         slowDebuff.timer -= Time.deltaTime;
         if (slowDebuff.timer <= 0)
         {
             slowDebuff   = null;
             currentSpeed = speed;
         }
     }
 }
コード例 #3
0
ファイル: Enemy.cs プロジェクト: dmitrycdz/LaboratoryDefense
    public void TakeSlowDebuff(SlowCube sc)
    {
        SlowDebuff newSlowDebuff = new SlowDebuff
        {
            attackType = sc.attackType,
            duration   = sc.slowDuration,
            timer      = sc.slowDuration
        };

        if (slowDebuff == null || newSlowDebuff > slowDebuff)
        {
            slowDebuff   = newSlowDebuff;
            currentSpeed = speed * slowDebuff.slowPercent;
        }
    }
コード例 #4
0
ファイル: Enemy.cs プロジェクト: dmitrycdz/LaboratoryDefense
    void Start()
    {
        totalHp           = hp;
        currentSpeed      = speed;
        stunned           = false;
        firingDebuff      = null;
        slowDebuff        = null;
        stunDebuff        = null;
        hpSlider          = GetComponentInChildren <Slider>();
        agent             = GetComponent <NavMeshAgent>();
        agent.speed       = currentSpeed;
        agent.destination = GameObject.Find("End").GetComponent <Transform>().position;

        gameManager.SubscribeEnemyKilled(this);
        gameManager.SubscribeEnemyReach(this);
        Player.currentPlayer.SubscribeEnemyKilled(this);
    }