// Update is called once per frame void Update() { if (PMC.isMoving() && !isMoving) { GetComponent <ParticleSystem>().Play(); isMoving = true; } else if (!PMC.isMoving() && isMoving) { GetComponent <ParticleSystem>().Stop(); isMoving = false; } }
void ManageAudio() { if (player.state != PlayerMasterController.PlayerStates.DEAD) { bool moving = player.isMoving(); if (moving && !wasMoving) { stepCount = stepSilence; } if (player.onSurface() && moving) { if (stepCount >= stepSilence) { sc.Play((int)PlayerSounds.WALK_STEP); stepCount = 0f; } stepCount += Time.deltaTime; } wasMoving = moving; } else { if (alive) { sc.Play((int)PlayerSounds.DEATH); alive = false; } } }
// Use this for initialization void Start() { player = GetComponent <PlayerMasterController> (); sc = GetComponent <SoundController> (); wasMoving = player.isMoving(); alive = true; }
// Update is called once per frame void Update() { //* if (player.state == PlayerMasterController.PlayerStates.ON_GROUND) { sprint = player.isRunning() && player.isMoving(); wall = false; Jump = false; air = false; } else if (player.state == PlayerMasterController.PlayerStates.JUMPING) { Jump = true; wall = false; } else if (player.state == PlayerMasterController.PlayerStates.ON_WALL) { Jump = false; air = false; } else if (player.state == PlayerMasterController.PlayerStates.ON_AIR) { air = true; Jump = false; wall = false; sprint = false; } else if (player.state == PlayerMasterController.PlayerStates.DEAD) { if (!dead) { reset(); death = true; dead = true; StartCoroutine(WaitForExit(4)); } } if (player.state != PlayerMasterController.PlayerStates.DEAD && dead) { death = false; } setBools(wall, Jump, sprint, air, death); /*/ * bool sideWalking = player.state == PlayerMasterController.PlayerStates.ON_WALL; * * if (player.onSurface()) { * jump = false; * anim.SetBool ("air", false); * anim.SetBool("Jump", false); * * if (sideWalking && !wall) { * wall = true; * anim.SetBool ("wall", true); * anim.speed = 1.0F; * } * } else if (player.state == PlayerMasterController.PlayerStates.ON_AIR) { * if (!sideWalking && wall) { * wall = false; * anim.SetBool ("wall", false); * anim.speed = 1.0F; * } else if(!jump) { * anim.SetBool ("air", true); * anim.SetBool ("Jump", false); * anim.speed = 1.0F; * } * } else if (player.state == PlayerMasterController.PlayerStates.DEAD) { * if (!dead) { * dead = true; * anim.SetBool ("death", true); * } else { * anim.SetBool ("death", false); * } * } * //*/ }