Beispiel #1
0
 public void BT_Skill1()
 {
     if ((
             curBehavior == PlayerBehavior.Idle ||
             curBehavior == PlayerBehavior.Run ||
             curBehavior == PlayerBehavior.Att1 ||
             curBehavior == PlayerBehavior.Att2 ||
             curBehavior == PlayerBehavior.Att3) &&
         sk1Button.IsReady)
     {
         StartNewState(PlayerBehavior.Sk_FireBall);
         sk1Button.StartCooldown();
     }
 }
Beispiel #2
0
    private void StartNewState(PlayerBehavior behavior)
    {
        curTime        = 0;
        rigid.velocity = Vector3.zero;
        rIndicator.gameObject.SetActive(false);


        trail.EndTrail();
        weapon.EndAttack();

        switch (behavior)
        {
        case PlayerBehavior.Idle:
            anim.SetTrigger("idle");
            break;

        case PlayerBehavior.Run:
            anim.SetTrigger("run");
            break;

        case PlayerBehavior.Roll:
            anim.SetTrigger("roll");
            Instantiate(rollEffectPrefab, transform);
            SoundMgr.Instance.Play(mainSoundPlayer, "Sliding", 1.0f);
            break;

        case PlayerBehavior.Att1:
            AutoTargetting();
            anim.SetTrigger("att1");
            weapon.SetDamage(att1Damage);
            PlayMainSound("PlayerAtt1", 0.4f);
            isSequenceAtt = false;
            break;

        case PlayerBehavior.Att2:
            AutoTargetting();
            anim.SetTrigger("att2");
            PlayMainSound("PlayerAtt2", 0.2f);
            weapon.SetDamage(att2Damage);
            isSequenceAtt = false;
            break;

        case PlayerBehavior.Att3:
            AutoTargetting();
            anim.SetTrigger("att3");
            PlayMainSound("PlayerAtt1", 0.5f);
            weapon.SetDamage(att3Damage);
            isSequenceAtt = false;
            break;

        case PlayerBehavior.Sk_FireBall:
            anim.SetTrigger("sk_fireball");
            trail.SetColor(Color.red);
            SoundMgr.Instance.Play(mainSoundPlayer, "PlayerBallSwing", 1.0f);
            break;

        case PlayerBehavior.Sk_SpawnGolem:
            anim.SetTrigger("sk_spawnGolem");
            curSpawnTime = 0;
            rIndicator.SetPosition(transform.position);
            rIndicator.SetMaxRad(rIndicatorMaxRad.y);
            sk2Button.StartCooldown();
            golemSpawnBodyEffect = Instantiate(golemSpawnBodyPrefab, transform.position, Quaternion.identity);
            PlayMainSound("LaserCharge", 0.5f, true);
            break;

        case PlayerBehavior.Sk_JumpGolem:
            anim.SetTrigger("idle");
            rIndicator.gameObject.SetActive(true);
            rIndicator.SetMaxRad(3.5f);
            sk3Button.StartCooldown();
            break;

        case PlayerBehavior.Die:
            anim.SetTrigger("die");
            GetComponent <Collider>().enabled = false;
            break;
        }

        curBehavior = behavior;
    }