Exemplo n.º 1
0
 public void MoveForwards(float time, DelegateTimer timerCallback)
 {
     movingBackwards     = false;
     movingForwards      = true;
     moveTimer           = time;
     timerCallbackObject = timerCallback;
 }
 public void AddDelegate(MyDelegate del, float time, int repeat)
 {
     for (int i = 1; i <= repeat; i++)
     {
         DelegateTimer toADD = new DelegateTimer(Time.time + (time * i), del);
         delegateTimerList.Add(toADD);
     }
 }
Exemplo n.º 3
0
    static void Main()
    {
        DelegateTimer myTimer = new DelegateTimer(Output);
        Timer         timer   = new Timer(5, 1000, myTimer);

        Thread myThread = new Thread(new ThreadStart(timer.Run));

        myThread.Start();

        Console.WriteLine("This doesn't afect the code below.");
        for (int i = 0; i < 5; i++)
        {
            Console.WriteLine("Harlem");
        }
    }
 private void InitTimers()
 {
     mAttackCoolDownTimer = new DelegateTimer(AttackCoolDownOff, EnemyStat.AttackStateCoolDown);
     mFreezeTimer = new DelegateTimer(FreezeOff, EnemyStat.FreezeDuration);
     mFreezeTimer.isPaused = true;
 }
Exemplo n.º 5
0
    public void AddDelegateTimer(MyDelg myDelg, float time, int callCount)
    {
        DelegateTimer timer = new DelegateTimer(myDelg, time + Time.time, callCount);

        timers.Add(timer);
    }
 void InitTimers()
 {
     mRestAfterAttackTimer = new DelegateTimer(DoneRest, EnemyStat.AfterAttackRestTime);
     mRestAfterAttackTimer.isPaused = true;
 }
Exemplo n.º 7
0
    public void ModifyScrollSpeed(float speedMultiplier, float time, ScrollModificationType speedModificationType, DelegateTimer timerCallback)
    {
        scrollSpeedMultiplier    = speedMultiplier;
        scrollSpeedModified      = true;
        scrollSpeedModifiedTimer = time;

        if (ScrollModificationType.SpeedUp == speedModificationType)
        {
            player2Movement.MoveForwards(time, timerCallback);
        }
        else if (ScrollModificationType.SlowDown == speedModificationType)
        {
            player2Movement.MoveBackwards(time, timerCallback);
        }
        else if (ScrollModificationType.BackToNormal == speedModificationType)
        {
            player2Movement.BackToNormal();
        }
    }
Exemplo n.º 8
0
 public Timer(int ticker, int timeInMiliSec, DelegateTimer output)
 {
     this.ticker        = ticker;
     this.timeInMiliSec = timeInMiliSec;
     this.output        = output;
 }
Exemplo n.º 9
0
    public void AddDelegateTimer(MyDelegate toInvoke, float time, int sameFunctionCallCount)
    {
        DelegateTimer toAdd = new DelegateTimer(toInvoke, Time.time + time, sameFunctionCallCount);

        delegateTimers.Add(toAdd);
    }
Exemplo n.º 10
0
 /// <summary>
 /// Times the worker.
 /// </summary>
 /// <param name="stateInfo">The state info.</param>
 private void TimeWorker(object stateInfo)
 {
     try
     {
         if (InvokeRequired)
         {
             var o = new DelegateTimer(TimeWorker);
             Invoke(o, stateInfo);
         }
         else
         {
             lblDate.Text = DateTime.Now.ToString("dddd, dd MMMM yyyy");
             lblTime.Text = DateTime.Now.ToString("HH:mm:ss");
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// Sets the company.
 /// </summary>
 /// <param name="stateInfo">The state info.</param>
 private void SetCompany(object stateInfo)
 {
     try
     {
         if (lblCompanyName.InvokeRequired)
         {
             var o = new DelegateTimer(SetCompany);
             lblCompanyName.Invoke(o, stateInfo);
         }
         else
         {
             List<Company> cmp = new CompanyBase().GetAll();
             if (cmp != null)
             {
                 lblCompanyName.Text = cmp[0].CompanyName;
                 lblCompanyDescription.Text =
                     string.Format("{0} {1}\r\nPhone: {2} Fax: {3}\r\nEmail: {4} ",
                                   cmp[0].Address, cmp[0].City, cmp[0].Phone,
                                   cmp[0].Fax, cmp[0].Email);
             }
         }
     }
     catch (Exception)
     {
     }
 }
    public void AddArgumentDeleGate(MyArgumentDelegate arg, float time)
    {
        DelegateTimer toadd = new DelegateTimer(time + Time.time, arg);

        delegateTimerList.Add(toadd);
    }