// Update is called once per frame
    void Update()
    {
        //Debug.Log(wall.GetChildCount());

        if (wall.childCount > 0)
        {
            currWall_Transform = wall.GetChild(0);
            Debug.Log(currWall_Transform);
        }
        current_WallPatrolScript = currWall_Transform.GetComponent <Wall_Patrol>();
        Debug.Log(current_WallPatrolScript.GetMoveSpeed());
        Debug.Log(player);
        originalMoveSpeed = current_WallPatrolScript.GetMoveSpeed();
        //wall.transform.rotation = new Quaternion(0, 0, 0, 0);

        /*if(wall.transform.position == wallDestinationPosition.position)
         * {
         *  //wall_patrolScript.SetMoveSpeed(originalMoveSpeed);
         *  current_WallPatrolScript.SetMoveSpeed(originalMoveSpeed);
         *  Destroy(player);
         *  player = PrefabUtility.InstantiatePrefab(Resources.Load("Zombie_Player"), playerSpawnPosition) as GameObject;
         * }*/
        if (currWall_Transform.position == wallDestinationPosition.position)
        {
            //wall_patrolScript.SetMoveSpeed(originalMoveSpeed);
            current_WallPatrolScript.SetMoveSpeed(originalMoveSpeed);
            Destroy(player);
            //player = PrefabUtility.InstantiatePrefab(Resources.Load("Zombie_Player"), playerSpawnPosition) as GameObject;
            player = Instantiate(playerManager.GetPlayerGameObject(), playerSpawnPosition);
        }
    }
Exemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (!isGameOver && playerLifeAmount < 1)
     {
         spawnerComponent.SetIsGameOver(true);
         Debug.Log("isgameover");
     }
     current_WallPatrolScript = wall.GetComponent <Wall_Patrol>();
     originalMoveSpeed        = current_WallPatrolScript.GetMoveSpeed();
     //wall.transform.rotation = new Quaternion(0, 0, 0, 0);
     if (wall.transform.position == wallDestinationPosition.position && spawnerComponent.GetWallAmount() > 1)
     {
         current_WallPatrolScript.SetMoveSpeed(originalMoveSpeed);
         Destroy(player);
     }
     if (playerLifeAmount < 1 && player)
     {
         GameObject.Find("ZombiePlayer_Spawn_Postion/1VRView_Zombie_Player(Clone)/rig/hips/HeadCameraHolder/FirstPersonView_MainCamera/Canvas_GameOver").SetActive(true);
         gameEndedText      = (Text)GameObject.Find("ZombiePlayer_Spawn_Postion/1VRView_Zombie_Player(Clone)/rig/hips/HeadCameraHolder/FirstPersonView_MainCamera/Canvas_GameOver/Text").GetComponent <Text>();
         gameEndedText.text = "GAME OVER";
         StartCoroutine(DelayAndExitToMenu(4f));
     }
     else if (playerLifeAmount > 0 && spawnerComponent.GetWallAmount() < 1 && player)
     {
         GameObject.Find("ZombiePlayer_Spawn_Postion/1VRView_Zombie_Player(Clone)/rig/hips/HeadCameraHolder/FirstPersonView_MainCamera/Canvas_GameOver").SetActive(true);
         gameEndedText      = (Text)GameObject.Find("ZombiePlayer_Spawn_Postion/1VRView_Zombie_Player(Clone)/rig/hips/HeadCameraHolder/FirstPersonView_MainCamera/Canvas_GameOver/Text").GetComponent <Text>();
         gameEndedText.text = "YOU WIN";
         StartCoroutine(DelayAndExitToMenu(5f));
     }
 }