예제 #1
0
        void Start()
        {
            phaseOrder = new Dictionary <EGamePhase, EGamePhase>()
            {
                { EGamePhase.MaintenancePhase, EGamePhase.CombatOrExplorationPhase },
                { EGamePhase.CombatOrExplorationPhase, EGamePhase.ClearPhase },
                { EGamePhase.ClearPhase, EGamePhase.WaitPhase },
                { EGamePhase.WaitPhase, EGamePhase.MaintenancePhase }
            };

            localPlayer       = NetworkManager.Instance.localPlayer;
            localPlayer.troop = GameConfig.INITIAL_TROOP;

            if (uiManager != null)
            {
                uiManager.UpdateTopUI(localPlayer, currentTurn);
                uiManager.SetCurrentTurnUI(currentTurn.ToString());
                uiManager.SetPlayerLevelUI(GameSetup.localPlayerTurnId.ToString());
            }

            if (GameSetup.localPlayerTurnId == 0)
            {
                DoTransitionToCombatExplorationPhase();
            }
            else
            {
                currentPhase = EGamePhase.ClearPhase;
                DoPhaseTransition();
            }

            GameSetup.playerRealColor = localPlayer.playerColor = ColorManager.instance.colors[GameSetup.playerColor];

            SetupPlayersInitialHexagon(localPlayer, true);
            SetupOpponents();
        }
예제 #2
0
        private void PassTurnTokenAhead()
        {
            turnTimerIsRunning = false;

            localPlayer.actions = 0;

            currentPhase = EGamePhase.WaitPhase;
            ProcessPhase();

            NetworkManager.Instance.PassTurnTokenToNextPlayer();
        }
예제 #3
0
 private void DoPhaseTransition()
 {
     try
     {
         currentPhase = phaseOrder[currentPhase];
         ProcessPhase();
     }
     catch (System.Exception e)
     {
         Debug.LogError(e.Message);
     }
 }
예제 #4
0
    private void Start()
    {
        _gamePhase = EGamePhase.Repare;

        _timer = TIME_OF_REPARE_PHASE;

        Debug.Assert(!_doNotDestroyOnLoad, "Manager should be destroyed on Load");
        _itemsCollected = new int[(int)EResourceType.Size];
        for (int i = 0; i < (int)EResourceType.Size; i++)
        {
            _itemsCollected[i] = 0;
        }
    }
예제 #5
0
    public void AdvancePhase()
    {
        if(hasAuthority)
        {
            if(currentPhase < EGamePhase.EndPhase)
            {
                currentPhase++;
            }
            else
            {
                firstPlayersTurn = !firstPlayersTurn;
                currentPhase = EGamePhase.DrawPhase;
            }

            Cmd_EventPhaseChanged((firstPlayersTurn ? 1 : 2), currentPhase);
        }
    }
예제 #6
0
    /// <summary>
    /// Go to the next phase
    /// </summary>
    public void NextPhase()
    {
        switch (Phase)
        {
        case EGamePhase.StartOfDay:
            Phase = EGamePhase.Working;
            OnWorkDay();
            break;

        case EGamePhase.Working:
            Phase = EGamePhase.EndOfDay;
            OnEndOfDay();
            break;

        default:
        case EGamePhase.EndOfDay:
            Phase = EGamePhase.StartOfDay;
            OnStartOfDay();
            break;
        }
    }
예제 #7
0
 /// <summary>
 /// Initialize this session from the data
 /// </summary>
 public void Initialize()
 {
     Phase = EGamePhase.None;
 }
예제 #8
0
	// Update is called once per frame
	void Update () 
	{
		if(IsGameInPogress())
			CurrentPhaseTime += Time.deltaTime;

		switch(CurrentGamePhase)
		{
			case EGamePhase.Prepare:
				DaysAmount = 0;
                Time.timeScale = 1f;
				CleanUp();
                SpawnAltar();
				for(int i = 0; i < Globals.VILLAGERS_START_AMOUNT; i++)
				{
					SpawnVillager();
				}
				CurrentGamePhase = EGamePhase.Day;
				Globals.POWER = Globals.START_POWER;
				SpawnPlayer();
			break;
			case EGamePhase.Day:
				if(CurrentPhaseTime > Globals.DAY_DURATION)
				{
					CurrentPhaseTime = CurrentPhaseTime % Globals.DAY_DURATION;
					CurrentGamePhase = EGamePhase.Night;
					// TODO: handle switch to night
					timeToSpawnBeast = Globals.NIGHT_DURATION;
				}
			break;
			case EGamePhase.Night:
				if(CurrentPhaseTime > Globals.NIGHT_DURATION)
				{
					CurrentPhaseTime = CurrentPhaseTime % Globals.NIGHT_DURATION;
					CurrentGamePhase = EGamePhase.Day;
					// TODO: handle switch to day
//					for(int i = 0; i < Beasts.Count; i++)
//					{
//						Beasts[i].Die();
//					}
					DaysAmount++;
				}
				else
				{
					timeToSpawnBeast += Time.deltaTime;
					if(CurrentPhaseTime < Globals.NIGHT_DURATION - Globals.BEAST_MERCY_TIME)
					{
						if(timeToSpawnBeast > (Globals.NIGHT_DURATION - Globals.BEAST_MERCY_TIME) / (Globals.START_BEAST_AMOUNT + DaysAmount * Globals.BEAST_AMOUNT_INCREASE))
						{
							SpawnBeast();
							timeToSpawnBeast = 0f;
						}
					}
				}
			break;
			case EGamePhase.GameOver:
                Time.timeScale = 0f;
			break;
		}
	}
예제 #9
0
	// Use this for initialization
	void Start () 
	{
		CurrentGamePhase = EGamePhase.Prepare;
	}
예제 #10
0
	public void GameOver(bool cultistsDead = false)
	{
		CurrentGamePhase = EGamePhase.GameOver;
        GameOverPanel.SetActive(true);
        if (cultistsDead)
        {
            LoseConditionText.text = "You have lost all your worshippers";
        }
        else if(!cultistsDead)
        {
            LoseConditionText.text = "You have been devoured by monsters";
        }
	}
예제 #11
0
    // place to run the whole logic of switching phase
    void GoToTheSecondStage()
    {
        _gamePhase = EGamePhase.Defend;

        OnStartSecondPhase.Invoke();
    }
예제 #12
0
    private void OnPhaseChanged(int player, EGamePhase phase)
    {
        if (phase == EGamePhase.MainPhase1 && player == playerNumber)
        {
            addCardToHand(field.getDeck().DrawTop());
            loadHandIntoSelectionItems();

            if (isLocalPlayer)
                hand[selectionIndex].GetComponent<ParticleSystem>().enableEmission = true;
            // Removed, press "Show Info" to display info pane now
            //StartCoroutine(cardInfoPane.FadeIn());
        }
        else if (phase == EGamePhase.BattlePhase && player == playerNumber)
        {
            loadMonstersIntoSelectionItems();
            if(selectionItems.Count > 0)
            {
                if (isLocalPlayer)
                    selectionItems[selectionIndex].GetComponent<ParticleSystem>().enableEmission = true;
            }
        }
        else if (phase == EGamePhase.MainPhase2 && player == playerNumber)
        {
            loadHandIntoSelectionItems();

            if (isLocalPlayer)
                hand[selectionIndex].GetComponent<ParticleSystem>().enableEmission = true;

            attackingFlag = false;
        }
        else if(phase == EGamePhase.EndPhase)
        {
            field.setMonstersCanAttack(true);
        }
    }
예제 #13
0
    // Use this for initialization
    void Start()
    {
        currentPhase = EGamePhase.DrawPhase;
        firstPlayersTurn = true;

        scoreboard.SetPhaseText(currentPhase.ToString());
        scoreboard.SetTurn(1);
    }
예제 #14
0
 private void Rpc_EventPhaseChanged(int player, EGamePhase phase)
 {
     EventPhaseChanged(player, phase);
 }
예제 #15
0
    // Handler for phase change
    private void OnCurrentPhaseChange(EGamePhase newPhase)
    {
        currentPhase = newPhase;

        scoreboard.SetPhaseText(currentPhase.ToString());
    }
예제 #16
0
 public void Cmd_EventPhaseChanged(int player, EGamePhase phase)
 {
     Rpc_EventPhaseChanged(player, phase);
 }