Пример #1
0
        public override void Update(Rusher_Controller_FSM rusher)
        {
            //check if the defender is in the way
            if (rusher.RayToQb().collider == null)
            {
                //Debug.Log("Oliner out of sight");
                rusher.TransitionToState(rusher.qbChase_State);
            }

            Vector2 localRight = rusher.transform.rotation * Vector2.right;

            myRb.AddForce(localRight * rusher.speed * Time.deltaTime);

            /*if (rushMode == RushMode.Outside)
             * {
             *  RushOutside(rusher);
             * }*/
            switch (rushMode)
            {
            case RushMode.Central:
                RushCentral(rusher);
                //Debug.Log(rushMode);
                break;

            case RushMode.Inside:
                RushInside(rusher);
                //Debug.Log(rushMode);
                break;

            case RushMode.Outside:
                RushOutside(rusher);
                //Debug.Log(rushMode);
                break;
            }
        }
Пример #2
0
        public override void Update(Rusher_Controller_FSM rusher)
        {
            RaycastHit2D hit = rusher.RayToQb();

            //check if the defender is in the way
            if (hit.collider != null)
            {
                rusher.Target = hit.transform;

                rusher.TransitionToState(rusher.oppVisible_State);
                //Debug.Log("Oliner in sight");
            }

            Vector2 localRight = rusher.transform.rotation * Vector2.right;

            myRb.AddForce(localRight * rusher.speed * Time.deltaTime);

            float angle = Vector2.SignedAngle(rusher.Target.position - rusher.transform.position, new Vector2(1.0f, 0.0f));

            myRb.MoveRotation(Mathf.LerpAngle(myRb.rotation, -angle, rusher.rotationSpeed * Time.deltaTime));
        }