示例#1
0
    void OnTriggerStay(Collider other)
    {
        if (other.CompareTag("Player") || other.CompareTag("PlayerParts"))
        {
            Vector3 direction = other.transform.position - transform.position;

            if (Physics.Raycast(transform.position, direction.normalized, out hit))
            {
                if (hit.collider.gameObject == player)
                {
                    if (hit.distance > 60)
                    {
                        ai.Chase();
                    }
                    if (hit.distance <= 40)
                    {
                        ai.Attack();
                    }
                }
            }
            else
            {
                ai.Idle();
            }
        }
    }
示例#2
0
        public override void Update(GameTime gameTime)
        {
            switch (state)
            {
            case CharaState.Normal:
                ai.Attack();
                Position = ai.Move();
                break;

            case CharaState.Damage:
                DamageUpdate(gameTime);
                break;

            case CharaState.Delete:
                isDeadFlag = true;
                mediator.AddGameObject(new SmokeEffect(Position, gameDevice));
                break;
            }
            //ai.Attack();
            //Position = ai.Move();

            //【追加】
            velocity = ai.Velocity();
            UpdateMyDirection();
            if (aiName == AIName.Shot)
            {
                UpdateShotMyDir();
            }
            currentMotion.Update(gameTime);
        }
示例#3
0
 public void Attacking()
 {
     if (!enemyStats.isDead)
     {
         enemyAI.Attack();
         Invoke("DealDamage", swingTime);
         StartCoroutine(AttackAgain());
     }
 }
示例#4
0
    void Update()
    {
        if (mAI.mState.GetState() == estate.Dead)
        {
            if (!mbDeadImpulse)
            {
                mRBody.constraints = RigidbodyConstraints.None;

                Vector3 smack = Random.onUnitSphere;
                smack += Vector3.up * 2f;

                mRBody.AddForce(smack * SmackDownForce, ForceMode.Impulse);
                mbDeadImpulse = true;
            }
            return;
        }

        if (mAI.mState.GetState() == estate.PissedOff)
        {
            //ready to attack?
            if (mStats.mCurGCD <= 0f)
            {
                //in range?
                if (mAI.InRange(AttackRange))
                {
                    mAI.Attack();
                    mStats.mCurGCD = mStats.mGCD;
                }
                else
                {
                    //chase
                    mAI.GoToEnemy();
                }
            }
            else
            {
                //in range?
                if (!mAI.InRange(AttackRange))
                {
                    //chase
                    mAI.GoToEnemy();
                }
            }
        }
    }