public override void Start() { base.Start(); behaviorFunc[(int)BossBehaviorKind.Run] = Run; behaviorFunc[(int)BossBehaviorKind.MeleeAttack] = MeleeAttack; behaviorFunc[(int)BossBehaviorKind.Laser] = ShootLaser; behaviorFunc[(int)BossBehaviorKind.Ball] = FireBalls; behaviorFunc[(int)BossBehaviorKind.Spawn] = SpawnMobs; behaviorFunc[(int)BossBehaviorKind.Curse] = CursePlayer; sqrAttRad = attRad * attRad; wand = GetComponentInChildren <MeleeWeapon>(); wand.SetDamage(damage); trail = GetComponentInChildren <WeaponTrail>(); trail.SetColor(Color.blue); colliderRad = GetComponent <CapsuleCollider>().radius; mobSpawnPts = FindObjectsOfType <MobSpawnPt>(); movePts = FindObjectsOfType <BossMovePt>(); selector = new Selector(); selector.Add(BossBehaviorKind.Run, 9); selector.Add(BossBehaviorKind.MeleeAttack, 10); selector.Add(BossBehaviorKind.Laser, 5); selector.Add(BossBehaviorKind.Ball, 9); selector.Add(BossBehaviorKind.Spawn, 4); selector.Add(BossBehaviorKind.Curse, 6); InitPostProcessing(); rIndicator.Init(laserLength, Color.blue, 15); }
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; }