Exemplo n.º 1
0
    private void LeaveState()
    {
        // use this to neatly clean up a state when leaving it
        switch (m_State)
        {
        case MatchState.StartingMatch:
        {
            break;
        }

        case MatchState.RoundPlaying:
        {
            break;
        }

        case MatchState.RoundFinished:
        {
            break;
        }

        case MatchState.MatchOver:
        {
            m_EndScreenManager = null;
            break;
        }

        default:
        {
            // THROW ERROR!
            throw new System.NotImplementedException("State missing in MatchManager.LeaveState()");
        }
        }
    }
Exemplo n.º 2
0
    void SetGameState(GameState newState)
    {
        EndScreenManager endScreenManager = GameObject.FindGameObjectWithTag("EndScreen").GetComponent <EndScreenManager>();

        switch (newState)
        {
        case GameState.TITLE:
            break;

        case GameState.PLAYING:
            break;

        case GameState.LOSE:
            audio.Stop();
            endScreenManager.SetEndingSprite("gameover");
            endScreenManager.DrawEnding();
            audio.PlayOneShot(loseTheme, 1f);
            break;

        case GameState.WIN:
            // reloads scene entirely
            endScreenManager.DrawEnding();
            audio.PlayOneShot(winTheme, 1f);
            break;

        default:
            Debug.LogError("Given unknown GameState: " + newState);
            break;
        }

        gameState = newState;
    }
Exemplo n.º 3
0
 // What happens if the player loses...
 public void OnLose()
 {
     runOnce = true;
     Debug.Log("PLAYER LOSES!");
     playerMove.enabled = false;                                 // Disables PlayerMovement Script Component on EndScreen
     EndScreenManager.GetInstance().LoseScreen();
 }
Exemplo n.º 4
0
 // What happens if the player wins...
 void OnWin()
 {
     runOnce = true;
     Debug.Log("PLAYER WINS!");
     playerMove.enabled = false;                                 // Disables PlayerMovement Script Component on EndScreen
     EndScreenManager.GetInstance().WinScreen();
 }
Exemplo n.º 5
0
    private void SetState(MatchState newState)
    {
        // leave current state
        LeaveState();

        // change to new state
        m_State = newState;

        // set up new state
        switch (m_State)
        {
        case MatchState.StartingMatch:
        {
            m_GameManager.Preload_Next_Level();
            foreach (AgentManager player in m_GameManager.Get_Players())
            {
                player.Zero_Score();
                player.Zero_Rounds_Won();
            }
            break;
        }

        case MatchState.RoundPlaying:
        {
            // Create the RoundManager
            m_RoundManager = new RoundManager(this, m_GameManager);
            break;
        }

        case MatchState.RoundFinished:
        {
            //save the winner of the round
            if (MatchWon())
            {
                SetState(MatchState.MatchOver);
            }
            else
            {
                SetState(MatchState.RoundPlaying);
            }
            break;
        }

        case MatchState.MatchOver:
        {
            m_EndScreenManager = new EndScreenManager(this, m_GameManager);
            break;
        }

        default:
        {
            // THROW ERROR!
            throw new System.NotImplementedException("State missing in MatchManager.SetState()");
        }
        }
    }
Exemplo n.º 6
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Exemplo n.º 7
0
 void Awake()
 {
     // Check if there isn't another instance
     if (instance != null && instance != this)
     {
         // Destroy the duplicate
         Destroy(this.gameObject);
     }
     else
     {
         // There isn't an instance set this as the instance
         instance = this;
     }
 }
Exemplo n.º 8
0
    void SelectGame()
    {
        // randomly pick from goalPhoto array and properly select the right inventory set and generate photos
        int index = Random.Range(0, goalPhotoGame.Length);

        var    inventory = basicInventory;
        string inventoryName;

        bool[] toFlip = new bool[] { false, false, false };

        switch (index)
        {
        case 0:
            inventoryName = "basic1";
            inventory     = basicInventory1;
            winPositions  = basic1WinPositions;
            toFlip        = new bool[] { false, true, false };
            break;

        case 1:
            inventoryName = "basic2";
            inventory     = basicInventory2;
            winPositions  = basic2WinPositions;
            toFlip        = new bool[] { true, true, false };
            break;

        case 2:
            inventoryName = "int1";
            inventory     = intermediateInventory;
            winPositions  = int1WinPositions;
            toFlip        = new bool[] { true, true, false };
            break;

        case 3:
            inventoryName = "int2";
            inventory     = intermediateInventory;
            winPositions  = int2WinPositions;
            toFlip        = new bool[] { false, true, false };
            break;

        case 4:
            inventoryName = "adv1";
            inventory     = advancedInventory1;
            winPositions  = adv1WinPositions;
            break;

        case 5:
            inventoryName = "adv2";
            inventory     = advancedInventory1;
            winPositions  = adv2WinPositions;
            toFlip        = new bool[] { true, true, true };
            break;

        default:
            inventoryName = "basic1";
            inventory     = basicInventory;
            break;
        }

        Debug.Log("win positions:");
        foreach (Vector3 pos in winPositions)
        {
            Debug.Log(pos);
        }

        GoalPhotoManager goalPhotoManager = GameObject.FindGameObjectWithTag("GoalPhoto").GetComponent <GoalPhotoManager>();

        goalPhotoManager.SetSprite(inventoryName);

        EndScreenManager endScreenManager = GameObject.FindGameObjectWithTag("EndScreen").GetComponent <EndScreenManager>();

        endScreenManager.SetEndingSprite(inventoryName);
        SpawnInventory(inventory, toFlip);
    }
Exemplo n.º 9
0
 private void Awake()
 {
     sharedInstance = this;
 }
Exemplo n.º 10
0
 public static void Set_EndScreenManager(EndScreenManager _endScreenM)
 {
     _endScreenManager = _endScreenM;
 }