Esempio n. 1
0
        protected override void OnCantMove <T>(T component) //**
        {
            #region                                         // component==Player
            if (component.tag == "Player")
            {
                PlayerInput hitPlayer = component as PlayerInput;

                hitPlayer.LoseHp(playerDamage);

                animator.SetTrigger("enemyAttack");

                SoundManager.instance.RandomizeSfx(attackSound1, attackSound2);
            }
            #endregion

            #region// component==Wall
            if (component.tag == "Wall")
            {
                //Set hitWall to equal the component passed in as a parameter.
                Destroyable hitWall = component as Destroyable;

                //Call the DamageWall function of the Wall we are hitting.
                hitWall.Damaged(wallDamage);

                animator.SetTrigger("enemyAttack");

                SoundManager.instance.RandomizeSfx(attackSound1, attackSound2);
            }
            #endregion

            StartCoroutine(ColorChangeCoroutine());
        }
Esempio n. 2
0
        //OnCantMove overrides the abstract function OnCantMove in MovingObject.
        //It takes a generic parameter T which in the case of Player is a Wall which the player can attack and destroy.
        protected override void OnCantMove <T> (T component)
        {
            //Set hitWall to equal the component passed in as a parameter.
            Destroyable hitWall = component as Destroyable;

            //Call the DamageWall function of the Wall we are hitting.
            hitWall.Damaged(wallDamage);

            //Set the attack trigger of the player's animation controller in order to play the player's attack animation.
            animator.SetTrigger("playerChop");
        }
        protected override void OnCantMove <T>(T component)
        {
            Destroyable hitWall = component as Destroyable;

            CheckAttack();           //プレイヤーの攻撃力Check
            hitWall.Damaged(attack); //攻撃
            if (attack == 1)
            {
                attack_particle.transform.position   = hitWall.transform.position;
                attack_particle.transform.localScale = transform.localScale;
                attack_particle.Play();
            }
            if (attack == 2)
            {
                attackUP_particle.transform.position   = hitWall.transform.position;
                attackUP_particle.transform.localScale = transform.localScale;
                attackUP_particle.Play();
            }
            animator.SetTrigger("playerChop");
        }