Beispiel #1
0
    private void OnCollisionEnter(Collision other)
    {
        var flag = other.gameObject.GetComponent <FlagController>();

        if (flag == null)
        {
            return;
        }
        CameraController.i.Shake();
        state = DozerState.Back;
        float   backSpeed = 10f;
        Vector3 dir       = -transform.forward;

        DOTween.To(() => backSpeed, (x) => backSpeed = x, 0, 0.7f)
        .SetEase(Ease.Linear)
        .OnUpdate(() =>
        {
            rb.velocity       = dir * backSpeed;
            transform.forward = -dir;
        })
        .OnComplete(() =>
        {
            state = DozerState.Control;
        });

        flag.Defeat(transform.forward);
    }
Beispiel #2
0
    public void AttackBound()
    {
        if (playerDozerController)
        {
            CameraController.i.Shake();
        }
        state = DozerState.Back;
        float   backSpeed = 15f;
        Vector3 dir       = -transform.forward;

        DOTween.To(() => backSpeed, (x) => backSpeed = x, 0, 0.7f)
        .SetEase(Ease.Linear)
        .OnUpdate(() =>
        {
            rb.velocity       = dir * backSpeed;
            transform.forward = -dir;
        })
        .OnComplete(() =>
        {
            state = DozerState.Control;
        });
    }
Beispiel #3
0
 void Start()
 {
     state = DozerState.Control;
 }