Exemple #1
0
    // Update is called once per frame
    public void Run()
    {
        switch (GameState)
        {
        case GameStates.States.Starting:
            Starting.Invoke();
            break;

        case GameStates.States.Loading:
            Loading.Invoke();
            break;

        case GameStates.States.Playing:
            Playing.Invoke();
            break;

        case GameStates.States.Dying:
            Dying.Invoke();
            break;

        case GameStates.States.Ending:
            Ending.Invoke();
            break;
        }
    }
Exemple #2
0
 protected override void Die()
 {
     Target.AddMoney(Reward);
     Dying?.Invoke(this);
     GetComponent <GoblinStateMachine>().ResetOnDie();
     gameObject.SetActive(false);
 }
Exemple #3
0
// Update is called once per frame
    public void Run()
    {
        switch (GameState)
        {
        case "Starting":
            Starting.Invoke();
            break;

        case "Dying":
            Dying.Invoke();
            break;

        case "Playing":

            Playing.Invoke();
            break;

        case "Ending":
            Ending.Invoke();
            break;

        case "Winning":
            Winning.Invoke();
            break;
        }
    }
Exemple #4
0
    void RunStates()      //Command will loop either state because switch is in update
    {
        switch (GameState)
        {
        case "Starting":
            Starting.Invoke();
            break;                     //stop and get out of the switch block

        case "Loading":
            Loading.Invoke();
            break;                     //stop and get out of the switch block

        case "Dying":
            Dying.Invoke();
            break;                     //stop and get out of the switch block

        case "Playing":
            Playing.Invoke();
            break;                     //stop and get out of the switch block

        case "Ending":
            Ending.Invoke();
            break;                     //stop and get out of the switch block
        }
    }
Exemple #5
0
 public void TakeDamage(int damage)
 {
     _health -= damage;
     if (_health <= 0)
     {
         Dying?.Invoke(this);
         Destroy(gameObject);
     }
 }
Exemple #6
0
    public void TakeDamage(float damage)
    {
        _health -= damage;

        if (_health <= 0)
        {
            Dying?.Invoke(this);
        }
    }
Exemple #7
0
    public void TakeDamage(int damage)
    {
        _health -= damage;
        _animator.SetTrigger("Hit");

        if (_health <= 0)
        {
            Dying?.Invoke(this); // передаем в событие спавнера экземпляр класса enemy
        }
    }
Exemple #8
0
    public void Takedamage(int damage)
    {
        _health -= damage;

        if (_health <= 0)
        {
            Dying?.Invoke(this);
            _animator.Play("Die");
            Destroy(gameObject, .3f);
        }
    }
Exemple #9
0
    private void Die()
    {
        _isDying             = true;
        _attackState.enabled = false;
        _moveState.enabled   = false;
        _jumpState.enabled   = false;

        Dying?.Invoke(this);
        _animator.Play("Die");
        Destroy(gameObject, _dieTime);
    }
Exemple #10
0
 public void TakeDamage(int damage)
 {
     if (damage >= _health)
     {
         _health = 0;
         Dying?.Invoke(this);
         Destroy(gameObject);
         return;
     }
     _health -= damage;
 }
Exemple #11
0
    public void TakeDamage(int damage)
    {
        _animator.SetTrigger("TakeDamage");
        _audioSource.Play();

        _currentHealth -= damage;
        HealthChanged?.Invoke(_currentHealth, _health);

        if (_currentHealth <= 0)
        {
            Dying?.Invoke(this);
            StartCoroutine(EnemyDying(_audioSource.clip.length));
        }
    }
Exemple #12
0
        public void Kill()
        {
            Dying?.Invoke(this);
            OnDying();

            if (m_DeathAnimation != null)
            {
                m_DeathAnimation.Resume();
            }
            else
            {
                die();
            }
        }
Exemple #13
0
    //Player takes damage function
    void TakeDamage(int damage)
    {
        //change players health
        currentHealth -= damage;
        Debug.Log("Player took " + damage + " damage!");

        //show change on health bar
        healthBar.SetHealth(currentHealth);

        if (currentHealth <= 0)
        {
            AudioHelper.PlayClip2D(_dying, .05f);
            Dying?.Invoke();
        }
    }
Exemple #14
0
 protected override void Die()
 {
     Target.AddMoney(Reward);
     Dying?.Invoke(this);
     gameObject.SetActive(false);
 }
Exemple #15
0
 private void Die()
 {
     Dying?.Invoke((int)_elapsedLifeTime, _score);
     Time.timeScale = 0;
 }
Exemple #16
0
 private void Die()
 {
     Dying?.Invoke();
 }
Exemple #17
0
 private void Die()
 {
     Dying?.Invoke(this, _healthReward);
 }
Exemple #18
0
 private void Die()
 {
     Dying?.Invoke(this);
     Destroy(gameObject);
 }
Exemple #19
0
 public void Die()
 {
     Dying?.Invoke(this);
     Instantiate(_deathEffect, transform.position, Quaternion.identity);
     Destroy(gameObject);
 }
Exemple #20
0
 protected override void Die()
 {
     Target.AddMoney(Reward);
     Dying?.Invoke(this);
     Destroy(gameObject);
 }
Exemple #21
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     Dying?.Invoke();
 }
Exemple #22
0
 /// <summary>
 /// метод при умирании
 /// </summary>
 public void Die()
 {
     Dying.Invoke(); // вызов метода из field
 }