void BounceFromWall(EffectsController.Side side) { if (timeSinceHit > 0.35f) { if (!hasBounceDodged) { canBounceDodge = true; } if (!hasBounceTongued) { canBounceTongue = true; } } if (((side == EffectsController.Side.Left || side == EffectsController.Side.Right) && Mathf.Abs(velocity.x) > 5f) || ((side == EffectsController.Side.Bottom || side == EffectsController.Side.Top) && Mathf.Abs(velocity.y) > 5f)) { EffectsController.CreateBouncePuff(transform.position + (Vector3)velocityT, side); SoundController.PlaySoundEffect("FrogBounce", 0.5f, transform.position); SoundController.PlaySoundEffect("FrogBounceVoice", 0.4f, transform.position); } if (state == CharacterState.Tounge) { state = CharacterState.Bouncing; } wasHitDownwards = false; }
static Vector3 GetOffsetForSide(EffectsController.Side side) { switch (side) { case Side.Top: return(new Vector3(0, 2f, 0f)); case Side.Bottom: return(new Vector3(0f, 0f, 0f)); case Side.Left: return(new Vector3(-1f, 1f, 0f)); case Side.Right: return(new Vector3(1f, 1f, 0f)); default: return(new Vector3(0f, 0f, 0f)); } }