Exemplo n.º 1
0
    public void EndTurn()
    {
        for (int index = 0; index < playerTeam.Count; index++)
            playerTeam[index].actorHasMovedThisTurn = false;

        for (int index = 0; index < enemyTeam.Count; index++)
            enemyTeam[index].actorHasMovedThisTurn = false;

        for (int index = 0; index < nuetrals.Count; index++)
            nuetrals[index].actorHasMovedThisTurn = false;

        if (currentTurn == UnitSide.player)
        {
            GridControlBehavior gridControl = GetComponent<GridControlBehavior>();
            if (gridControl != null)
                gridControl.EndTurn();

            currentTurn = UnitSide.enemy;
            leftToMoveThis = enemyTeamTotal;
            controller.whoseTurn.text = "Enemy Turn";
        }
        else
        {
            currentTurn = UnitSide.player;
            leftToMoveThis = playerTeamTotal;
            controller.whoseTurn.text = "Player Turn";
            numberOfTurns++;
            controller.turnCount.text = "Turn " + numberOfTurns.ToString();

            if(SceneConversationBehavior.instance != null)
                if (SceneConversationBehavior.instance.battleQuips.Length >= numberOfTurns)
                    Camera.main.GetComponent<TalkingEventManagerBehaviour>().StartTalkingEventChain(SceneConversationBehavior.instance.battleQuips[numberOfTurns - 1]);
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if(enemyTeamTotal == 0)
        {
            Application.LoadLevel("PlayerWins");
        }

        if (playerTeamTotal == 0)
        {
            Application.LoadLevel("PlayerLosses");
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            for (int index = 0; index < playerTeam.Count; index++)
                playerTeam[index].actorHasMovedThisTurn = false;

            for (int index = 0; index < enemyTeam.Count; index++)
                enemyTeam[index].actorHasMovedThisTurn = false;

            for (int index = 0; index < nuetrals.Count; index++)
                nuetrals[index].actorHasMovedThisTurn = false;

            if (currentTurn == UnitSide.player)
                currentTurn = UnitSide.enemy;
            else
                currentTurn = UnitSide.player;
        }
    }
Exemplo n.º 3
0
    public void EndTurn()
    {
        for (int index = 0; index < playerTeam.Count; index++)
        {
            playerTeam[index].actorHasMovedThisTurn = false;
        }

        for (int index = 0; index < enemyTeam.Count; index++)
        {
            enemyTeam[index].actorHasMovedThisTurn = false;
        }

        for (int index = 0; index < nuetrals.Count; index++)
        {
            nuetrals[index].actorHasMovedThisTurn = false;
        }

        if (currentTurn == UnitSide.player)
        {
            GridControlBehavior gridControl = GetComponent <GridControlBehavior>();
            if (gridControl != null)
            {
                gridControl.EndTurn();
            }

            currentTurn               = UnitSide.enemy;
            leftToMoveThis            = enemyTeamTotal;
            controller.whoseTurn.text = "Enemy Turn";
        }
        else
        {
            currentTurn               = UnitSide.player;
            leftToMoveThis            = playerTeamTotal;
            controller.whoseTurn.text = "Player Turn";
            numberOfTurns++;
            controller.turnCount.text = "Turn " + numberOfTurns.ToString();

            if (SceneConversationBehavior.instance != null)
            {
                if (SceneConversationBehavior.instance.battleQuips.Length >= numberOfTurns)
                {
                    Camera.main.GetComponent <TalkingEventManagerBehaviour>().StartTalkingEventChain(SceneConversationBehavior.instance.battleQuips[numberOfTurns - 1]);
                }
            }
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// Performs the appropriate Update method based on the state machine.
    /// </summary>
    public void Update()
    {
        if (controller.AllowPlayerControlledEnemies && controlState == GridControlState.AwaitingEnemy)
        {
            controlState = GridControlState.SelectingUnit;
            inputSide    = enemySide;
            return;
        }

        switch (controlState)
        {
        case GridControlState.SelectingUnit:
            updateSelectingUnit();
            return;

        case GridControlState.SelectingMovement:
            updateSelectingMovement();
            return;

        case GridControlState.AwaitingMovement:
            if (!selectedSquad.canMove)
            {
                controlState = GridControlState.SelectingTarget;
            }
            return;

        case GridControlState.SelectingTarget:
            updateSelectingTarget();
            return;

        case GridControlState.AwaitingCombat:
            updateAwaitingCombat();
            return;

        case GridControlState.AwaitingEnemy:
            if (controller.currentTurn == GameControllerBehaviour.UnitSide.player)
            {
                controlState = GridControlState.SelectingUnit;
            }
            return;

        default:
            return;
        }
    }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        //if(enemyTeamTotal == 0)
        //{
        //    Application.LoadLevel("PlayerWins");
        //}

        //if (playerTeamTotal == 0)
        //{
        //    Application.LoadLevel("PlayerLosses");
        //}

        if (Input.GetKeyDown(KeyCode.Space) || leftToMoveThis == 0)
        {
            for (int index = 0; index < playerTeam.Count; index++)
                playerTeam[index].actorHasMovedThisTurn = false;

            for (int index = 0; index < enemyTeam.Count; index++)
                enemyTeam[index].actorHasMovedThisTurn = false;

            for (int index = 0; index < nuetrals.Count; index++)
                nuetrals[index].actorHasMovedThisTurn = false;

            if (currentTurn == UnitSide.player)
            {
                currentTurn = UnitSide.enemy;
                leftToMoveThis = enemyTeamTotal;
            }
            else
            {
                currentTurn = UnitSide.player;
                leftToMoveThis = playerTeamTotal;
            }
        }
    }
Exemplo n.º 6
0
	/// <summary>
	/// Performs the appropriate Update method based on the state machine.
	/// </summary>
	public void Update()
	{
		if(controller.AllowPlayerControlledEnemies && controlState == GridControlState.AwaitingEnemy)
		{
			controlState = GridControlState.SelectingUnit;
			inputSide = enemySide;
			return;
		}

		switch(controlState)
		{
		case GridControlState.SelectingUnit:
			updateSelectingUnit();
			return;

		case GridControlState.SelectingMovement:
			updateSelectingMovement();
			return;

		case GridControlState.AwaitingMovement:
			if(!selectedSquad.canMove)
				controlState = GridControlState.SelectingTarget;
			return;

		case GridControlState.SelectingTarget:
			updateSelectingTarget();
			return;

		case GridControlState.AwaitingCombat:
			updateAwaitingCombat();
			return;

		case GridControlState.AwaitingEnemy:
			if(controller.currentTurn == GameControllerBehaviour.UnitSide.player)
				controlState = GridControlState.SelectingUnit;
			return;

		default:
			return;
		}
	}