Пример #1
0
 public static void RefreshPlayerView()
 {
     CursorController.HideAttackCursors();
     CursorController.HideConfirmAttackCursors();
     CursorController.ShowMoveCells();
     CursorController.RefreshAlarmCursors();
     SetState(State.PickAction);
     Menu.Refresh();
     ActionInformation.Hide();
     DeathInformation.Refresh();
     MenuCamera.Refresh();
 }
Пример #2
0
    // Update is called once per frame
    public static void Cancel()
    {
        ActionInformation.Hide();

        if (GameController.state == GameController.State.PickAction && selected)
        {
            ResetPath();
        }
        if (GameController.state == GameController.State.PickTarget || GameController.state == GameController.State.ConfirmTarget)
        {
            GameController.CancelAttack();
        }
    }
Пример #3
0
    public void DoAction(int x, int z, int actionIndex)
    {
        MainCamera.Lock();
        MainCamera.CenterOnWorldPoint(Unit.current.transform.position);
        ActionInformation.Hide();
        GameObject actionObject = Actions()[actionIndex];
        UnitAction action       = actionObject.GetComponent <UnitAction>();

        Cursor cursor = CursorController.cursorMatrix[x][z];

        GameObject actionDialogueObject = Instantiate(actionDialoguePrefab, transform.position, Quaternion.identity);

        actionDialogueObject.GetComponent <ActionDialogue>().message = action.Name();
        actionDialogueObject.GetComponent <ActionDialogue>().unit    = this;
        actionObject.GetComponent <UnitAction>().currentMp           = currentMp;
        System.Action beginAction = () => { actionObject.GetComponent <UnitAction>().BeginAction(cursor.gameObject); };
        currentMp -= action.MpCost();
        actionDialogueObject.GetComponent <ActionDialogue>().whenDone = beginAction;

        LookToward(x, z);
    }
Пример #4
0
    public void SetUnit(UnitConfig unitConfig, int index, ConfigTypes configType)
    {
        transform.Find("InfoPanel").Find("UnitName").GetComponent <Text>().text  = unitConfig.unitName;
        transform.Find("InfoPanel").Find("UnitClass").GetComponent <Text>().text = unitConfig.unitClass.Name();

        int           i           = 0;
        List <string> actions     = unitConfig.unitClass.Actions();
        List <string> unitActions = unitConfig.actions;

        if (configType == ConfigTypes.Stance)
        {
            actions     = unitConfig.unitClass.Stances();
            unitActions = unitConfig.stances;
        }

        foreach (Transform entry in transform.Find("Grid"))
        {
            bool enableClick = true;
            int  c           = i;

            entry.GetComponent <Button>().onClick.RemoveAllListeners();

            if (i < actions.Count)
            {
                entry.gameObject.active = true;

                string label       = "";
                string description = "";
                string mpCost      = "";

                if (configType == ConfigTypes.Stance)
                {
                    label       = unitConfig.stanceMap[actions[c]].Name();
                    description = unitConfig.stanceMap[actions[c]].Description();
                    mpCost      = "0";
                }
                else
                {
                    UnitAction action = unitConfig.actionMap[actions[c]];
                    label       = unitConfig.actionMap[actions[c]].Name();
                    description = action.actionType().ToString() + " -- " + action.Description();
                    if (action.VariableMp())
                    {
                        mpCost = "Variable";
                    }
                    else
                    {
                        mpCost = unitConfig.actionMap[actions[c]].MpCost().ToString();
                    }
                }

                entry.Find("Text").GetComponent <Text>().text = label;

                entry.Find("Text").GetComponent <Text>().color = Color.white;

                if (actions[c] == unitActions[index])
                {
                    entry.Find("Text").GetComponent <Text>().color = Color.green;
                }
                else if (unitActions.Contains(actions[c]))
                {
                    enableClick = false;
                    entry.Find("Text").GetComponent <Text>().color = new Color(1, 1, 1, .5f);
                }

                ActionConfigButton configButton = entry.GetComponent <ActionConfigButton>();
                configButton.actionName  = label;
                configButton.description = description;
                configButton.mpCost      = mpCost;

                if (enableClick)
                {
                    entry.GetComponent <Button>().onClick.AddListener(
                        () => {
                        ActionInformation.Hide();
                        this.SetAction(unitConfig, index, actions[c], configType);
                    });
                }
            }
            else
            {
                entry.gameObject.active = false;
            }

            i++;
        }
    }
Пример #5
0
 public void OnPointerExit(PointerEventData eventData)
 {
     ActionInformation.Hide();
 }
Пример #6
0
 public void StartMoving()
 {
     ActionInformation.Hide();
     GameController.StartMoving(this);
     MainCamera.Lock();
 }