Ejemplo n.º 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;
        }
    }
Ejemplo n.º 2
0
 protected override void Die()
 {
     Target.AddMoney(Reward);
     Dying?.Invoke(this);
     GetComponent <GoblinStateMachine>().ResetOnDie();
     gameObject.SetActive(false);
 }
Ejemplo n.º 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;
        }
    }
Ejemplo n.º 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
        }
    }
Ejemplo n.º 5
0
 public void TakeDamage(int damage)
 {
     _health -= damage;
     if (_health <= 0)
     {
         Dying?.Invoke(this);
         Destroy(gameObject);
     }
 }
Ejemplo n.º 6
0
    public void TakeDamage(float damage)
    {
        _health -= damage;

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

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

        if (_health <= 0)
        {
            Dying?.Invoke(this);
            _animator.Play("Die");
            Destroy(gameObject, .3f);
        }
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 10
0
 public void TakeDamage(int damage)
 {
     if (damage >= _health)
     {
         _health = 0;
         Dying?.Invoke(this);
         Destroy(gameObject);
         return;
     }
     _health -= damage;
 }
Ejemplo n.º 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));
        }
    }
Ejemplo n.º 12
0
        public void Kill()
        {
            Dying?.Invoke(this);
            OnDying();

            if (m_DeathAnimation != null)
            {
                m_DeathAnimation.Resume();
            }
            else
            {
                die();
            }
        }
Ejemplo n.º 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();
        }
    }
Ejemplo n.º 14
0
 protected override void Die()
 {
     Target.AddMoney(Reward);
     Dying?.Invoke(this);
     gameObject.SetActive(false);
 }
Ejemplo n.º 15
0
 private void Die()
 {
     Dying?.Invoke((int)_elapsedLifeTime, _score);
     Time.timeScale = 0;
 }
Ejemplo n.º 16
0
 private void Die()
 {
     Dying?.Invoke();
 }
Ejemplo n.º 17
0
 private void Die()
 {
     Dying?.Invoke(this, _healthReward);
 }
Ejemplo n.º 18
0
 private void Die()
 {
     Dying?.Invoke(this);
     Destroy(gameObject);
 }
Ejemplo n.º 19
0
 public void Die()
 {
     Dying?.Invoke(this);
     Instantiate(_deathEffect, transform.position, Quaternion.identity);
     Destroy(gameObject);
 }
Ejemplo n.º 20
0
 protected override void Die()
 {
     Target.AddMoney(Reward);
     Dying?.Invoke(this);
     Destroy(gameObject);
 }
Ejemplo n.º 21
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     Dying?.Invoke();
 }
Ejemplo n.º 22
0
 /// <summary>
 /// метод при умирании
 /// </summary>
 public void Die()
 {
     Dying.Invoke(); // вызов метода из field
 }