Example #1
0
    //-----------------------------------------------------------------

    public void SetupNewRound()
    {
        InputManager.Instance.InputEnabled = false;

        m_CurrentState        = TurnState.INTRO_STATE;
        m_TurnTrigger         = DataManager.Data.TurnTime;
        m_WaitForInputTrigger = DataManager.Data.WaitForInputTime / (1 / DataManager.Data.SlowDownScale);

        int numberPlayers = UIManager.Instance.PlaySettings.Counter;

        if (SpawnPointList.Count == 0)
        {
            SpawnPointList = new List <Vector3>(GetSpawnPoints(ArenaObject));
        }

        CameraManager.Instance.InitCamera(new Vector3(0f, 6f, -6f));
        CameraManager.Instance.SetCameraPositionBoundaries(7.168935f, -7.168935f, 7.168935f, -7.168935f);

        DataManager.Data.ActualHitGroup   = new AudioManager.AudioGroup(DataManager.Data.HitGroup);
        DataManager.Data.ActualGruntGroup = new AudioManager.AudioGroup(DataManager.Data.GruntGroup);

        if (ActiveFightersList.Count == 0)
        {
            for (int i = 0; i < numberPlayers; i++)
            {
                Unit fighter = new PlayerUnit("SharkDude", DataManager.Data.CharacterNames[i], i, SpawnPointList[i]);
                InputManager.Instance.AssignUnitToNextController(fighter);
                AliveFightersList.Add(fighter);
                ActiveFightersList.Add(fighter);
                UIManager.Instance.GameUI.CreatePanel(DataManager.Data.CharacterNames[i], fighter.FaceCam);

                // moved here for simplicity
                fighter.OnTakeDamage = () => { UIManager.Instance.GameUI.UpdateHpFor(fighter.UId.UnitID, fighter.HealthPercentage()); };
                fighter.OnDeath      = () => Die(fighter);
            }
        }

        for (int i = 0; i < ActiveFightersList.Count; i++)
        {
            CameraManager.Instance.AddTarget(ActiveFightersList[i].UnitObj);
            ActiveFightersList[i].ResetHealth();
            ActiveFightersList[i].ResetQueue();
            ActiveFightersList[i].SetWinDance(false);
            if (!AliveFightersList.Contains(ActiveFightersList[i]))
            {
                AliveFightersList.Add(ActiveFightersList[i]);
            }
        }
        UIManager.Instance.GameUI.ShowPanel();
        UIManager.Instance.StartCountDown();
    }