Пример #1
0
 public void GrantTurn(TurnToken token)
 {
     this.token           = token;
     completedTurnActions = 0;
     token.OnActionFinished.AddListener(OnActionDone);
     entity.Events.TriggerEvent(new EntityGrantTurnEvent(entity));
 }
    List <string> CalculateTurnOrder(int _time)
    {
        //Debug.Log("CalculateturnOrder");
        List <TurnToken> tokens = new List <TurnToken>();

        foreach (Battler i in allCharacters.Where(x => x.isAlive))
        {
            TurnToken token = new TurnToken();
            token.name      = i.name;
            token.turnDelay = i.turnDelay;
            token.speed     = i.Stats.Speed;
            tokens.Add(token);
        }

        List <string> final = new List <string>();

        while (final.Count < _time)
        {
            bool hit = false;
            foreach (TurnToken i in tokens)
            {
                if (i.turnDelay <= 0)
                {
                    string name = i.name;
                    //Debug.Log(i.name);
                    final.Add(name);
                    i.turnDelay += 100;
                    hit          = true;
                    break;
                }
            }
            if (hit == false)
            {
                foreach (TurnToken i in tokens)
                {
                    i.turnDelay -= (i.speed / 100f);
                }
            }
        }
        //Debug.Log(final);
        return(final);
    }
Пример #3
0
 public void Interact(Entity actor, TurnToken token)
 {
     token.BufferAction(interaction.Interact(actor, entity));
 }
Пример #4
0
 public void RevokeTurn(TurnToken token)
 {
     token.OnActionFinished.RemoveListener(OnActionDone);
     this.token = null;
     entity.Events.TriggerEvent(new EntityRevokeTurnEvent(entity));
 }
Пример #5
0
        public void Move(int2 step, TurnToken token)
        {
            MoveEntityAction action = new MoveEntityAction(entity, entity.CellTransform.Position + step);

            token.BufferAction(action);
        }
Пример #6
0
 public void Move(int xStep, int yStep, TurnToken token)
 {
     Move(new int2(xStep, yStep), token);
 }