Exemple #1
0
        public virtual void Damage(int damage, CaptainEnemy captain, EnemyController enemy)
        {
            //if (HP <= 0) return;

            enemyInfo.hp -= damage;
            if (enemyInfo.hp <= 0)
            {
                if (captain != null)
                {
                    captain.RemoveAbeSan(enemy);
                }
                enemyInfo.hp = 0;
            }

            if (enemyInfo.pushForce_y > 0)
            {
                enemyInfo.animator.Play("Down");
            }
            else
            {
                AnimatorStateInfo nowState = enemyInfo.animator.GetCurrentAnimatorStateInfo(0);
                if (nowState.IsName("Damage"))
                {
                    enemyInfo.animator.Play("Damage_2");
                }
                else
                {
                    enemyInfo.animator.Play("Damage");
                }
            }

            nextState = new AnomalyState(enemyInfo);
            //nextState.Push (pushForce_z, pushForce_y, pushDirection);
        }
Exemple #2
0
        // Update is called once per frame
        void Update()
        {
            nowState = nowState.nextState;
            Vector3 movement = nowState.Run();

            movement *= Time.deltaTime;
            characterController_.Move(movement);
            nowState.isGrounded = characterController_.isGrounded;

            if (transform.position.y <= -20f)
            {
                transform.position = captain.transform.position;
            }
        }
Exemple #3
0
 public void Prepare(PlayerController p, CaptainEnemy cap, EnemyData data)
 {
     animator             = GetComponent <Animator> ();
     player               = p;
     captain              = cap;
     characterController_ = GetComponent <CharacterController> ();
     //collision = GetComponentInChildren<AbeCollision> ();
     enemyInfo               = new EnemyInformation(animator, player, transform);
     enemyInfo.hp            = data.Hp;
     enemyInfo.attack        = data.attack;
     enemyInfo.moveSpeed     = data.speed;
     enemyInfo.range         = data.range;
     nowState                = new NormalState(enemyInfo);
     nowState.targetPosition = transform.position;
 }