public void MorphTo(PlayerType type) { if (playerType == type) { return; } PlayerType playerTypePrevious = playerType; playerType = type; // Load new metadata switch (playerType) { case PlayerType.Jazz: RequestMetadata("Interactive/PlayerJazz"); break; case PlayerType.Spaz: RequestMetadata("Interactive/PlayerSpaz"); break; case PlayerType.Lori: RequestMetadata("Interactive/PlayerLori"); break; case PlayerType.Frog: RequestMetadata("Interactive/PlayerFrog"); break; } // Refresh animation state currentSpecialMove = SpecialMoveType.None; currentAnimation = null; SetAnimation(currentAnimationState); // Set transition if (type == PlayerType.Frog) { PlaySound("Transform"); controllable = false; controllableTimeout = 120f; switch (playerTypePrevious) { case PlayerType.Jazz: SetTransition((AnimState)0x60000000, false, delegate { controllable = true; controllableTimeout = 0f; }); break; case PlayerType.Spaz: SetTransition((AnimState)0x60000001, false, delegate { controllable = true; controllableTimeout = 0f; }); break; case PlayerType.Lori: SetTransition((AnimState)0x60000002, false, delegate { controllable = true; controllableTimeout = 0f; }); break; } } else if (playerTypePrevious == PlayerType.Frog) { controllable = false; controllableTimeout = 120f; SetTransition(AnimState.TransitionFromFrog, false, delegate { controllable = true; controllableTimeout = 0f; }); } else { Explosion.Create(levelHandler, Transform.Pos + new Vector3(-12f, -6f, -4f), Explosion.SmokeBrown); Explosion.Create(levelHandler, Transform.Pos + new Vector3(-8f, 28f, -4f), Explosion.SmokeBrown); Explosion.Create(levelHandler, Transform.Pos + new Vector3(12f, 10f, -4f), Explosion.SmokeBrown); Explosion.Create(levelHandler, Transform.Pos + new Vector3(0f, 12f, -6f), Explosion.SmokePoof); } }