problem is when game over myplayer not stop??cube(player) not stop??
Code:
1.playermanager.cs
public class PlayerManager : MonoBehaviour
{
internal static bool moving;
}
cube.cs
private void FixedUpdate()
{
if (hit.collider.gameObject.tag == "Obstacle")
{
PlayerManager.moving = false;
}
}
GameManager.cs
Rigidbody rb;
int managehome;
bool stops;
void FixedUpdate()
{
completecall();
}
void Start()
{
rb = GameObject.Find("Player4").GetComponent<Rigidbody>();
}
void completecall()
{
switch (managehome)
{
case 1:
home2.SetActive(true); //home2 active
Debug.Log("run or not");
home1.SetActive(false);
home3.SetActive(false);
home4.SetActive(false);
StartCoroutine(playeractivesecond()); //second player active
managehome++;
homeanim2.enabled = true;
break;
case 2:
home3.SetActive(true); //home3 active
home2.SetActive(false);
home1.SetActive(false);
home4.SetActive(false);
StartCoroutine(playeractivethird()); //third player active
managehome++;
homeanim3.enabled = true;
break;
case 3:
home4.SetActive(true); //home4 active
home1.SetActive(false);
home2.SetActive(false);
home3.SetActive(false);
StartCoroutine(playeractivefour()); //fourth player active
homeanim4.enabled = true;
managehome++;
break;
case 4:
gameovercanvas.SetActive(true);
rb.velocity = Vector3.zero; // i want to home 4 player stop when gameover canvas call //but still he move
}
Home4:Player4:
RigidBody CubeScript:
player4 rigidbody