Beispiel #1
0
 public static void DisponseTimers()
 {
     fire1DownTimer = null;
     fire2DownTimer = null;
     jumpDownTimer  = null;
     sitDownTimer   = null;
 }
Beispiel #2
0
    public static void Handle()
    {
        if (LMB == 0 && Input.GetAxisRaw("Fire1") >= 1 && fire1DownTimer == null)
        {
            fire1DownTimer = Timer.StartNewTimer("Fire1Down", DownFireTime, 1, null, timer => { fire1DownTimer = null; });
        }
        if (RMB == 0 && Input.GetAxisRaw("Fire2") >= 1 && fire2DownTimer == null)
        {
            fire2DownTimer = Timer.StartNewTimer("Fire2Down", DownFireTime, 1, null, timer => { fire2DownTimer = null; });
        }
        if (JumpAxis == 0 && Input.GetAxisRaw("Jump") >= 1 && jumpDownTimer == null)
        {
            jumpDownTimer = Timer.StartNewTimer("JumpDown", DownJumpAndSitAxisTime, 1, null, timer => { jumpDownTimer = null; });
        }
        if (SitAxis == 0 && Input.GetAxisRaw("Sit") >= 1 && sitDownTimer == null)
        {
            sitDownTimer = Timer.StartNewTimer("SitDown", DownJumpAndSitAxisTime, 1, null, timer => { sitDownTimer = null; });
        }

        HorizontalAxis = Input.GetAxisRaw("Horizontal");
        JumpAxis       = Input.GetAxisRaw("Jump");
        SitAxis        = Input.GetAxisRaw("Sit");
        LMB            = Input.GetAxisRaw("Fire1");
        RMB            = Input.GetAxisRaw("Fire2");
    }
Beispiel #3
0
    public override void EndAttack()
    {
        if (cdTimer != null)
        {
            return;
        }
        cdTimer = Timer.StartNewTimer("CD", 0.1f, 1, gameObject, x => { cdTimer = null; });

        isAttack = false;
        if (!clickPostAttack)
        {
            oldCombo        = currentCombo;
            currentCombo    = -1;
            postAttackTimer = Timer.StartNewTimer("PlayerPostAttack", comboTimerError, 1, gameObject, timer1 => {
                postAttackTimer = null;
                currentCombo    = -1;
            }, (timer1, f, arg3, arg4) => {
                if (clickPostAttack)
                {
                    clickPostAttack = false;
                    currentCombo    = oldCombo;
                    Attack();
                }
            });
        }
        else
        {
            clickPostAttack = false;
            Attack();
        }
    }
Beispiel #4
0
    public static bool IsSitDown(bool resetValue)
    {
        bool result = sitDownTimer != null;

        if (resetValue)
        {
            sitDownTimer = null;
        }
        return(result);
    }
Beispiel #5
0
    public static bool IsJumpDown(bool resetValue)
    {
        bool result = jumpDownTimer != null;

        if (resetValue)
        {
            jumpDownTimer = null;
        }
        return(result);
    }
Beispiel #6
0
    public static bool IsFire2Down(bool resetValue)
    {
        bool result = fire2DownTimer != null;

        if (resetValue)
        {
            fire2DownTimer = null;
        }
        return(result);
    }
Beispiel #7
0
    private void Attack()
    {
        AttackEvent result = info.GetEventSystem <AttackEvent>().CallListners(new AttackEvent(gameObject));

        if (result.IsCancel)
        {
            return;
        }

        isAttack     = true;
        currentCombo = (currentCombo + 1) >= numberOfCombo ? 0 : currentCombo + 1;
        if (postAttackTimer != null)
        {
            postAttackTimer.Remove();
            postAttackTimer = null;
        }
    }
 private void Start()
 {
     timer = Timer.StartNewTimer("ProjectileLifeTimer", timeOfLife, 1, gameObject, timer0 => {
         Destroy(toRemove);
     });
 }