protected override IEnumerator AbilityRoutine(Vector3 inputVec, RobotMotor robotMotor)
        {
            float triggerTime      = BoltNetwork.serverTime;
            float distanceToGround = 10;

            RaycastHit hit;

            while (BoltNetwork.serverTime <= triggerTime + 0.50f)
            {
                if (Physics.Raycast(transform.position + Vector3.up, Vector3.down, out hit, 10))
                {
                    distanceToGround = hit.distance - 1.05f;
                }

                distanceToGround = Mathf.Clamp(distanceToGround, 0, 10);

                if (distanceToGround <= 0.75f || robotMotor._IsGrounded || robotMotor._MotorState.timeSinceLastJumpableNormal < 0.256f)
                {
                    abilityVec = ForceVec(inputVec, robotMotor);
                    robotMotor.ConsumeAbility();

                    SendEventHandler.SendPlaySoundEvent("VelocityRedirect", true, transform.position);
                    break;
                }

                yield return(new WaitForFixedUpdate());
            }

            yield return(new WaitForFixedUpdate());

            abilityVec = Vector3.zero;
        }
Ejemplo n.º 2
0
        protected override IEnumerator AbilityRoutine(Vector3 inputVec, RobotMotor robotMotor)
        {
            abilityVec = transform.forward * 24.0f;
            //abilityVec = robotMotor._MotorState.velocity * 0.66f;

            robotMotor.ConsumeAbility();
            SendEventHandler.SendPlaySoundEvent("Boost", true, transform.position);

            yield return(new WaitForFixedUpdate());

            abilityVec = Vector3.zero;
        }