public void SetState(NinjiaState state) { this.state = state; switch (state) { case NinjiaState.RUN: GetComponent <Animator>().SetBool("isRun", true); if (run && !run.isPlaying) { run.Play(); } break; case NinjiaState.IDLE: GetComponent <Animator>().SetBool("isRun", false); if (run) { run.Stop(); } break; case NinjiaState.DEAD: GetComponent <Animator>().SetBool("isDead", true); GetComponent <Rigidbody2D>().isKinematic = true; if (dead) { dead.Play(); } break; } }
public void SetState(NinjiaState state) { this.state = state; switch (state) { case NinjiaState.FIRST_JUMP: case NinjiaState.SECOND_JUMP: Camera.main.GetComponent<CameraFollow>().enabled = true; GetComponent<Animator>().SetBool("isJump", true); if (run) run.Stop(); if (jump) jump.Play(); break; case NinjiaState.RUN: Camera.main.GetComponent<CameraFollow>().enabled = false; GetComponent<Animator>().SetBool("isJump", false); if (run && !run.isPlaying) run.Play(); break; case NinjiaState.DEAD: Camera.main.GetComponent<CameraFollow>().enabled = false; if (run) run.Stop(); if (dead) dead.Play(); GetComponent<Animator>().SetBool("isDead", true); break; } }
void Start() { state = NinjiaState.FALL_INIT; _isStart = false; _hitList = new List<GameObject>(); if (run) run.Play(); }
public void SetState(NinjiaState state) { this.state = state; switch (state) { case NinjiaState.ATTACK: lastAttackTime = Time.time; GetComponent<Animator>().SetInteger("attackType",1); if (attack) attack.Play(); break; case NinjiaState.SECOND_ATTACK: lastAttackTime = 0; GetComponent<Animator>().SetInteger("attackType", 2); if (attack) attack.Play(); break; case NinjiaState.FIRST_JUMP: case NinjiaState.SECOND_JUMP: GetComponent<Animator>().SetBool("isJump", true); if (run) run.Stop(); if (jump) jump.Play(); break; case NinjiaState.ON_GROUND: GetComponent<Animator>().SetBool("isJump", false); GetComponent<Animator>().SetInteger("attackType", 0); if (run && !run.isPlaying) run.Play(); break; case NinjiaState.DEAD: if (run) run.Stop(); if (dead) dead.Play(); GetComponent<Animator>().SetBool("isDead", true); break; case NinjiaState.CRASH: GetComponent<Animator>().SetBool("isCrash", true); if (run) run.Stop(); break; case NinjiaState.LOSE: GetComponent<Animator>().SetBool("isLose", true); if (run) run.Stop(); break; } }
public void SetState(NinjiaState state) { this.state = state; switch (state) { case NinjiaState.RUN: GetComponent<Animator>().SetBool("isRun", true); if (run && !run.isPlaying) run.Play(); break; case NinjiaState.IDLE: GetComponent<Animator>().SetBool("isRun", false); if (run) run.Stop(); break; case NinjiaState.DEAD: GetComponent<Animator>().SetBool("isDead", true); GetComponent<Rigidbody2D>().isKinematic = true; if (dead) dead.Play(); break; } }