Exemplo n.º 1
0
    void Update()
    {
        if (list == null)
        {
            list = new List <myTimer>();
        }

        bool delete = false;

        // Copies the current list to another one to allows the timers
        // to modify the tasks list (for instance : adding new tasks)
        List <myTimer> currentList = new List <myTimer>(list);

        foreach (myTimer t in currentList)
        {
            delete = delete || UpdateTimer(t);
        }

        if (delete)
        {
            int l = list.Count;
            for (int i = 0; i < l; i++)
            {
                myTimer t = list[i];

                if (t.callback == null)
                {
                    list.Remove(t);
                    i--;
                    l--;
                }
            }
        }
    }
Exemplo n.º 2
0
    public static void AddTimer(float time, CallBack callback)
    {
        myTimer t = new myTimer();
        t.remainingTime = time;
        t.callback = callback;

        if(list == null)
            list = new List<myTimer>();

        list.Add(t);
    }
Exemplo n.º 3
0
    public static void AddTimer(float time, CallBack callback)
    {
        myTimer t = new myTimer();

        t.remainingTime = time;
        t.callback      = callback;

        if (list == null)
        {
            list = new List <myTimer>();
        }

        list.Add(t);
    }
Exemplo n.º 4
0
    private bool UpdateTimer(myTimer t)
    {
        t.remainingTime -= Time.deltaTime;
        if (t.remainingTime <= 0)
        {
            if (t.callback != null)
                t.callback();

            t.callback = null;
            return true;
        }

        return false;
    }
Exemplo n.º 5
0
    private bool UpdateTimer(myTimer t)
    {
        t.remainingTime -= Time.deltaTime;
        if (t.remainingTime <= 0)
        {
            if (t.callback != null)
            {
                t.callback();
            }

            t.callback = null;
            return(true);
        }

        return(false);
    }
    // Use this for initialization
    void Awake()
    {
        this.animator = this.GetComponent<Animator> ();
        this.YakukoController = Yakuko.GetComponent<Script_SpriteStudio_PartsRoot> ();

        this.YakukoController.AnimationPlay (4, 0, 1, 1.0f);

        this.PlayerState = YakukoState.Sageru;

        this.timer = new myTimer ();
    }