Пример #1
0
    public static int Register(ITurn new_turnable)
    {
        if (Instance == null)
        {
            return(0);
        }

        if (Instance.Turnables == null)
        {
            Instance.Turnables = new List <ITurn>();
        }

        if (!Instance.Turnables.Contains(new_turnable))
        {
            MDebug.Log("^turnSystem TURNABLE: register " + new_turnable.GetID());
            Instance.Turnables.Add(new_turnable);
            // Instance.NormalizeList();
            Instance.SortListByTime();
            Instance.OnListUpdated.AttemptCall(Instance.Turnables);

            return(Instance.Turnables.Count);
        }

        Instance.SortListByTime();
        return(-1);
    }
Пример #2
0
 public static void Unregister(ITurn turnable)
 {
     if (turnable == Instance.Current)
     {
         Instance.Current = null;
     }
     if (Instance.Turnables.Contains(turnable))
     {
         MDebug.Log("^turnSystem REMOVE " + turnable.GetID());
         Instance.Turnables.Remove(turnable);
         Instance.OnListUpdated.AttemptCall(Instance.Turnables);
     }
 }