示例#1
0
    public override TaskStatus OnUpdate()
    {
        if (numOfPattern.Value != 5)
        {
            return(TaskStatus.Failure);
        }

        if (hpPostionScript.deadOrLive == 1)
        {
            return(TaskStatus.Failure);
        }

        if ((aniStart == false) && Vector3.Distance(transform.position, target.Value.position) < checkPatternForEnemyScript.bossAttackDistancePattern[5])
        {
            ischaseStart = false;
            bossAniScript01.bossPatternChoice(numOfPattern.Value);
            weaponColliderConScript.weaponColliderOn(0);
            aniStart = true;
        }


        if ((aniStart == true) && (startTime + 0.4f < Time.time))
        {
            weaponColliderConScript.weaponColliderOff();
        }
        if ((aniStart == true) && (startTime + 2f < Time.time))
        {
            weaponColliderConScript.weaponColliderOn(0);
        }
        if ((aniStart == true) && (startTime + endTime < Time.time))
        {
            return(TaskStatus.Failure);
        }
        if (ischaseStart == true)
        {
            transform.position = Vector3.Lerp(transform.position, target.Value.position, bossAttackSpeedPattern);
        }


        rotateBoss();

        return(TaskStatus.Running);
    }
    private void OnTriggerExit(Collider other)
    {
        if (IsAttackedState == CloseAttackEnemy01IsAttacked.attacked)
        {
            return;
        }
        switch (other.gameObject.tag)
        {
        case "PlayerSword01":
            hpPostionScript.enemyDamagedAndImageChange(0.2f);
            hpPostionScript.enemyHpDeadCheck();

            camShackManagerScript.shake();
            timeManagerScript.playerAttackTime();

            hitObjOnOff();

            if (hpPostionScript.deadOrLive == 1)
            {
                skinMeshRender.materials[0].color = Color.white;
                aniScript.aniSet("Dead");
                Destroy(this.gameObject, 3f);
            }
            else
            {
                if (isAttack == true)
                {
                    return;
                }

                aniScript.aniSet("Hitted");
                IsAttackedState = CloseAttackEnemy01IsAttacked.attacked;
                Invoke("stateChange", 0.3f);
            }

            if (stunParicle.isPlaying)
            {
                stunParicle.Stop();
            }
            break;

        case "PlayerSword02":
            hpPostionScript.enemyDamagedAndImageChange(0.5f);
            hpPostionScript.enemyHpDeadCheck();

            camShackManagerScript.shake();
            timeManagerScript.playerAttackTime();

            hitObjOnOff();

            if (hpPostionScript.deadOrLive == 1)
            {
                skinMeshRender.materials[0].color = Color.white;
                aniScript.aniSet("Dead");
                Destroy(this.gameObject, 3f);
            }
            else
            {
                Invoke("hitObjOnOff", 1f);

                if (isAttack == true)
                {
                    return;
                }

                aniScript.aniSet("Hitted");
                IsAttackedState = CloseAttackEnemy01IsAttacked.attacked;
                Invoke("stateChange", 0.3f);
            }

            if (stunParicle.isPlaying)
            {
                stunParicle.Stop();
            }
            break;

        case "PlayerSword03":
            hpPostionScript.enemyDamagedAndImageChange(0.8f);
            hpPostionScript.enemyHpDeadCheck();

            camShackManagerScript.shake();
            timeManagerScript.playerAttackTime();

            hitObjOnOff();

            if (hpPostionScript.deadOrLive == 1)
            {
                skinMeshRender.materials[0].color = Color.white;
                aniScript.aniSet("Dead");
                Destroy(this.gameObject, 3f);
            }
            else
            {
                Invoke("hitObjOnOff", 1f);

                if (isAttack == true)
                {
                    return;
                }

                aniScript.aniSet("Hitted");
                IsAttackedState = CloseAttackEnemy01IsAttacked.attacked;
                Invoke("stateChange", 0.3f);
            }

            if (stunParicle.isPlaying)
            {
                stunParicle.Stop();
            }
            break;
        }

        if ((IsAttackedState == CloseAttackEnemy01IsAttacked.stuned) ||
            (PlayerInputScript.Instance.state != PlayerState.parring) ||
            (isAttack == false))
        {
            return;
        }

        switch (other.gameObject.name)
        {
        case "Player_Weapon_Shield":
            hpPostionScript.enemyDamagedAndImageChange(0.2f);
            hpPostionScript.enemyHpDeadCheck();

            camShackManagerScript.shake();
            timeManagerScript.playerAttackTime();

            weaponColConScript.weaponColliderOff(0);

            parringObjOnOff();

            if (hpPostionScript.deadOrLive == 1)
            {
                skinMeshRender.materials[0].color = Color.white;
                aniScript.aniSet("Dead");
                Destroy(this.gameObject, 3f);
            }
            else
            {
                stunParicle.Play();
                isStun = true;

                aniScript.aniSet("Stuned");
                IsAttackedState = CloseAttackEnemy01IsAttacked.stuned;
                Invoke("parringObjOnOff", 3f);
                Invoke("stateChange", 1.5f);
            }
            break;
        }
    }
 void resetWeaponCollider()
 {
     aniOff();
     ani.SetBool("Bool_Enemy_Waiting", true);
     weaponColliderConScript.weaponColliderOff(0);
 }
    public override void OnStart()
    {
        velo = Vector3.zero;

        startTime  = Time.time;
        randomTime = Random.Range(minRandomTime, maxRandomTime);

        switch (thisGameObjName.Value)
        {
        case "CloseAttackEnemy01":
            hpPostionScript = GetComponent <EnemyHpPostionScript>();
            closeAttackTypeNormalColliderCon = GetComponent <CloseAttackTypeNormalColliderCon>();
            closeAttackEnemyaniScript        = GetComponent <CloseAttackTypeNormalAni>();
            closeAttackEnemyaniScript.aniSet("Reset_Ani");
            break;

        case "DistanceAttackEnemy01":
            distanceAttackEnemyaniScript = GetComponent <DistanceAttackTypeNormalAni>();
            distanceAttackEnemyaniScript.aniSet("Reset_Ani");
            break;

        case "Boss_01(Clone)":
            boss01ColliderCon       = GetComponent <Boss01ColliderCon>();
            bossAniScript01         = GetComponent <BossAniScript>();
            weaponColliderConScript = GetComponent <WeaponColliderCon>();

            weaponColliderConScript.weaponColliderOff();

            for (int i = 1; i < 10; i++)
            {
                float num = 0;
                switch (i)
                {
                case 1:
                    num = 8f;
                    break;

                case 2:
                    num = 3f;
                    break;

                case 3:
                    num = 2f;
                    break;

                case 4:
                    num = 2f;
                    break;

                case 5:
                    num = 2f;
                    break;

                case 6:
                    num = 2f;
                    break;

                case 7:
                    num = 1.5f;
                    break;

                case 8:
                    num = 1.6f;
                    break;

                case 9:
                    num = 2f;
                    break;
                }

                bossAttackDistancePattern[i] = num;
            }
            break;
        }
    }