Exemplo n.º 1
0
    public void RemoveTurnPlayingObject(TurnPlayingObject toRemove)
    {
        int indexToRemove = allPlayingObjects.FindIndex(x => currentPlayingObject == x);

        allPlayingObjects.RemoveAt(indexToRemove);
        //nothing to clean properly?
    }
Exemplo n.º 2
0
    public void AddTimedLifeModifer(TurnPlayingObject objectToModify, TimedLifeModifier modifier)
    {
        TurnPlayingObjectWithTimedModifiers objectGroup = allPlayingObjects.Find(x => x.mainObject == objectToModify);

        if (objectGroup != null)
        {
            objectGroup.timedModifers.Add(modifier);
        }
        else
        {
            Debug.Log("object not found");
        }
    }
Exemplo n.º 3
0
    public void AddObject(TurnPlayingObject objectToAdd)
    {
        Debug.Log("object to add" + (objectToAdd != null) + ((Unit)objectToAdd).positionInGrid);

        TurnPlayingObjectWithTimedModifiers adaptedObjectToAdd       = new TurnPlayingObjectWithTimedModifiers(objectToAdd);
        IEnumerator <TurnPlayingObjectWithTimedModifiers> enumerator = allPlayingObjects.GetEnumerator();

        int position = 0;

        while (enumerator.MoveNext() && enumerator.Current.mainObject.GetInitiative() > objectToAdd.GetInitiative())
        {
            position++;
        }

        Debug.Log("unit added at position " + position);
        allPlayingObjects.Insert(position, adaptedObjectToAdd);
    }
Exemplo n.º 4
0
 void Update()
 {
     if (currentPlayingObject != null)
     {
         TurnPlayingObject currentObject = currentPlayingObject.mainObject;
         if (currentObject.HasTurnEnded())
         {
             Debug.Log("manager launch the next unit turn");
             currentPlayingObject.shouldPlay = currentObject.GetBudget() >= currentObject.GetMinimalTurnCost();                   // and find a way to take into account the donothing choice
             OnTurnEnded();
         }
     }
     else
     {
         Debug.Log("no current playing object ");
         if (allPlayingObjects.Count > 0)
         {
             Debug.Log("manager is trying to launch a turn");
             LaunchTurn();
         }
     }
 }
Exemplo n.º 5
0
        public bool shouldPlay = false;         // false : the unit has chosen to do nothing, not enough points to do something, true : points have been modified, hasnt played yet AND has enough points

        public TurnPlayingObjectWithTimedModifiers(TurnPlayingObject _mainObject)
        {
            mainObject    = _mainObject;
            timedModifers = new List <TimedLifeModifier> ();
            shouldPlay    = true;
        }