Пример #1
0
    // Update is called once per frame
    void Update()
    {
        selector.SetActive(isSelected);

        switch (currentState)
        {
        case TurnState.IDLE:
            break;

        case TurnState.PROCESSING_TURN:
            //fill the turn metter accourding to your speed
            FillTurnMetter();
            break;

        case TurnState.CHOOSE_ACTION:
            client.CharacterATBReady(owner);
            //ChooseAction();
            currentState = TurnState.BSM_PROCESSING;
            break;

        case TurnState.BSM_PROCESSING:
            if (BSM.TurnOrderContatinsHero(owner))
            {
                BSM.CharactersToManage.Add(this);
                currentState = TurnState.IDLE;
            }
            break;

        case TurnState.ACTION:
            //can have animations, will later add a baseMoveAnimation or a ProjectielLaunchAnimation
            StartCoroutine(Action());
            break;

        case TurnState.DEAD:
            //Disable UI Character Button
            if (!owner.IsAlive)
            {
                BSM.OnCharacterDeath(owner);
                this.gameObject.tag = "Dead";
                isSelected          = false;
                //disable Character Button on GUI
                foreach (Turn turn in BSM.TurnOrder)
                {
                    if (turn.Attacker == owner)
                    {
                        BSM.TurnOrder.Remove(turn);
                    }
                }
            }
            else if (owner.IsAlive)
            {
                BSM.OnCharacterResurection(owner);
                currentState = TurnState.PROCESSING_TURN;
            }
            break;
        }
    }