Esempio n. 1
0
 private void Update()
 {
     if (myPlayer == null)
     {
         myPlayer = FindObjectOfType <VRPlayerScript>();
     }
 }
Esempio n. 2
0
    public void OnPointerClick(PointerEventData eventData)
    {
        VRPlayerScript player = FindObjectOfType <VRPlayerScript>();

        player.TurretMode(gameObject);
        GunActive(true);
    }
Esempio n. 3
0
    void SetupPhase(GamePhase newPhase)
    {
        phase = newPhase;
        switch (phase)
        {
        case GamePhase.PRE_GAME:
            //make sure the spawnWalls are all enabled:
            //TODO or reload Scene
            break;

        case GamePhase.GAME:
            //disable all spawnWalls:
            foreach (GameObject sw in spawnWalls)
            {
                Destroy(sw);
            }
            //collect players
            vrPlayer    = GameObject.FindObjectOfType <VRPlayerScript>();
            playerStats = GameObject.FindObjectsOfType <PlayerStats>();
            //notify players that the game has started
            foreach (PlayerStats ps in playerStats)
            {
                ps.OnGameStarted(livesPerPlayer, gameDurationSeconds);
            }
            vrPlayer.OnGameStarted(livesPerPlayer, gameDurationSeconds);
            break;

        case GamePhase.AFTER_GAME:
            foreach (PlayerStats ps in playerStats)
            {
                ps.OnGameFinished(playerStats);
            }
            vrPlayer.OnGameFinished(playerStats);
            break;
        }
    }