Ejemplo n.º 1
0
    private void GameOver(bool player1won)
    {
        ControlSelectionManager.controlSelectionManagerInstance.GetComponent <ControlSelectionManager>().OnActivateAction  -= OnDeviceLost;
        ControlSelectionManager.controlSelectionManagerInstance.GetComponent <ControlSelectionManager>().controlsSetAction -= OnControlsSet;

        Odyssey.VoyageAction     -= ballScriptReference.Voyage;
        Hawking.WellAction       -= ballScriptReference.GravityWell;
        Hawking.WellActiveAction -= UpdateGravityWell;
        ResetRoundAction          = null;

        if (GameOverAction != null)
        {
            GameOverAction(player1won);
        }
    }
Ejemplo n.º 2
0
    private void InitializeGame()
    {
        if (p1Selected != CharacterSelectionManager.Character.none)
        {
            p1Instance = Instantiate(shipPrefabList[(int)p1Selected - 1], p1Position.transform);
        }

        if (p1Selected == CharacterSelectionManager.Character.NULL)
        {
            InitializeNULL(true);
        }

        if (p1Instance != null)
        {
            InitializeShip(true);
        }

        if (p2Selected != CharacterSelectionManager.Character.none)
        {
            p2Instance = Instantiate(shipPrefabList[(int)p2Selected - 1], p2Position.transform);
        }

        if (p2Selected == CharacterSelectionManager.Character.NULL)
        {
            InitializeNULL(false);
        }

        if (p2Instance != null)
        {
            InitializeShip(false);
        }

        BindPlayersFunction(p1Instance.GetComponent <PlayerInput>(), p2Instance.GetComponent <PlayerInput>());

        ballReference = Instantiate(ballPrefab, Vector2.zero, Quaternion.identity);
        ballReference.transform.parent = transform;
        ballScriptReference            = ballReference.GetComponent <Ball>();

        Odyssey.VoyageAction     += ballScriptReference.Voyage;
        Hawking.WellAction       += ballScriptReference.GravityWell;
        Hawking.WellActiveAction += UpdateGravityWell;

        if (p1Selected == CharacterSelectionManager.Character.Hawking || p2Selected == CharacterSelectionManager.Character.Hawking)
        {
            gravityWellAnimator.gameObject.SetActive(true);
        }

        Dio.timeStopAction = UpdateTheWorld;
        if (p1Selected == CharacterSelectionManager.Character.Francesco)
        {
            ResetRoundAction += p1Instance.GetComponent <Francesco>().OnResetRound;
        }

        if (p2Selected == CharacterSelectionManager.Character.Francesco)
        {
            ResetRoundAction += p2Instance.GetComponent <Francesco>().OnResetRound;
        }

        if (p1Selected == CharacterSelectionManager.Character.Nagate || p2Selected == CharacterSelectionManager.Character.Nagate)
        {
            ResetRoundAction += SmokeBomb.OnRoundReset;
        }
    }