Esempio n. 1
0
    public void InitTurn()
    {
        ActiveSkill = -1;

        if (!IsPlaying)
        {
            AttributesSheet.UpdateAttributesDuration();
            UpdateSkillsCooldowns();
            UpdateSkillsUses();
        }

        IsPlaying = true;
        CombatUIManager.UpdateActionPoint(AttributesSheet.GetAttribute(AttributeType.ActionPoint));
        CombatUIManager.UpdateMovementPoint(AttributesSheet.GetAttribute(AttributeType.MovementPoint));

        SelfProjection.gameObject.SetActive(false);
        ActionState = ActionState.Waiting;
    }
Esempio n. 2
0
    public override IEnumerator Turn()
    {
        InitTurn();
        Debug.Log("(Player) " + UnitName + " turn");

        CombatUIManager.RefreshUI();
        CombatUIManager.SetActiveAllButtons(true, AttributesSheet.GetAttribute(AttributeType.MovementPoint));
        CombatUIManager.UpdateSkillsButtons();

        while (ActionState != ActionState.EndTurn && IsAlive)
        {
            switch (ActionState)
            {
            case ActionState.LookingForMovement:
                if (AttributesSheet.GetAttribute(AttributeType.MovementPoint) != 0)
                {
                    if (ProjectionManager.SelectionState != SelectionState.AvailableMovement)
                    {
                        ProjectionManager.SelectAvailableMovement(CurrentCell, AttributesSheet.GetAttribute(AttributeType.MovementPoint), SelectionState.AvailableMovement);
                    }
                }
                else
                {
                    Debug.Log("Can't move, no movementPoint available");
                    ActionState = ActionState.Waiting;
                }
                break;

            case ActionState.Waiting:
                if (ProjectionManager.SelectionState != SelectionState.CurrentCell &&
                    ProjectionManager.SelectionState != SelectionState.OtherAvailableMovement)
                {
                    ProjectionManager.SelectCurrentCell(CurrentCell, Team);
                }
                break;

            default:
                break;
            }
            yield return(new WaitForFixedUpdate());
        }
        AttributesSheet.RemoveCosts();
        ProjectionManager.ClearProjections();
        SelfProjection.gameObject.SetActive(true);
        IsPlaying = false;
        yield return(null);
    }
Esempio n. 3
0
    private AITurn ComputeTurn()
    {
        float[,] influenceMap = InfluenceMap.GetInfluenceMap(MapInfos, Team.Player);

        InfluenceMapDrawer drawer = GameObject.Find("InfluenceMapDrawer").GetComponent <InfluenceMapDrawer>();

        drawer.influenceMap = influenceMap;

        AITurn turn = new AITurn();

        turn.Actions = new List <AIAction>();

        AIActionMovement movement = new AIActionMovement();

        movement.GetHighestScore(influenceMap, CurrentCell.X, CurrentCell.Z, (int)MapInfos.Size.x, (int)MapInfos.Size.y, AttributesSheet.GetAttribute(AttributeType.MovementPoint));
        turn.Actions.Add(movement);

        /* while (enough AP to use a skill || enough MP to move) {
         *
         *  // if (enough AP to use a skill) {
         *
         *      - Get Available Skills
         *
         *      if (health == low && has a healing skill)
         *          Use healing skill
         *      else {
         *          - Get potential targets in Range
         *          - Get skill cellTarget
         *          - Add potential kills to turn
         *          - Add potential damage to turn
         *      }
         *
         *  } else (Move) {
         *      GetInfluenceMap(Team.Player);
         *      AIActionMovement movement = new AIActionMovement();
         *      if (CurrentHealth > 50%) {
         *          GetHighestScore();
         *      } else
         *          GetLowestScore();
         *      turns.Action.Add(movement);
         *  }
         */
        return(turn);
    }