public override void Step(CharControlMotor player, float deltaTime)
    {
        player.HandleGravity(deltaTime);
        player.HandleFall();

        power -= ((power / player.stats.SpinpowerLoss) / 256f) * deltaTime;

        if (player.grounded)
        {
            if (player.input.down)
            {
                if (player.input.actionDown)
                {
                    player.sonicState = CharControlMotor.SonicState.ChargingSpin;
                    power            += player.stats.SpinchargePower;
                    power             = Mathf.Min(power, player.stats.SpinmaxChargePower);
                    player.PlayAudio(player.audios.spindash_charge, 0.5f);
                }
            }
            else
            {
                player.state.ChangeState <RollPlayerState>();
            }
        }
    }
示例#2
0
 public override void Enter(CharControlMotor player)
 {
     player.attacking = true;
     player.particles.brakeSmoke.Play();
     player.disableSkinRotation = true;
     player.PlayAudio(player.audios.spindash, 0.5f);
     player.PlayerObject.GetComponent <PlayerMotor>().ChangeBounds(1);
 }
 public override void Exit(CharControlMotor player)
 {
     //player.skin.ActiveBall(false);
     player.velocity.x = (player.stats.SpinminReleasePower + (Mathf.Floor(power) / 2)) * player.direction;
     player.PlayAudio(player.audios.spindash, 0.5f);
     player.particles.spindashSmoke.Stop();
     player.sonicState = CharControlMotor.SonicState.Spindash;
 }
 public override void Enter(CharControlMotor player)
 {
     player.attacking = false;
     player.ChangeBounds(0);
     player.PlayAudio(player.audios.brake);
     player.UpdateDirection(player.velocity.x);
     //player.skin.SetEulerY(90 - player.direction * 90);
     player.particles.brakeSmoke.Play();
 }
示例#5
0
 public override void Enter(CharControlMotor player)
 {
     player.GroundExit();
     player.EnableCollision(false);
     player.attacking           = false;
     player.Death               = true;
     player.disableSkinRotation = true;
     player.disableCameraFollow = true;
     player.velocity            = Vector3.zero;
     player.velocity.y          = player.stats.diePushUp;
     player.PlayAudio(player.audios.death);
 }
示例#6
0
    public override void Exit(CharControlMotor player)
    {
        //player.skin.ActiveBall(false);
        if (chargeAmount >= chargeNeededToShootOff)
        {
            player.velocity.x = (player.stats.PeelminReleasePower + (Mathf.Floor(power) / 2)) * player.direction;
            player.PlayAudio(player.audios.peel_launch, 0.5f);
            player.sonicState = CharControlMotor.SonicState.Peel;
        }

        player.particles.spindashSmoke.Stop();
        player.disableSkinRotation = false;
    }
    public override void Enter(CharControlMotor player)
    {
        power            = 0;
        player.attacking = true;
        //player.skin.ActiveBall(true);
        player.ChangeBounds(1);
        player.PlayAudio(player.audios.spindash_charge, 0.5f);

        // Move particle emission right
        if (player.direction == -1)
        {
            player.particles.spindashSmoke.transform.localScale = new Vector3(-1, 1, 0);
        }
        // Move particle emission left
        else
        {
            player.particles.spindashSmoke.transform.localScale = new Vector3(1, 1, 0);
        }
        player.particles.spindashSmoke.Play();
    }
示例#8
0
    public override void Step(CharControlMotor player, float deltaTime)
    {
        player.UpdateDirection(player.input.horizontal);
        player.HandleAcceleration(deltaTime);
        player.HandleGravity(deltaTime);


        if (!player.grounded && player.attacking)
        {
            if (player.input.actionUp && player.velocity.y > player.stats.minJumpHeight)
            {
                player.velocity.y = player.stats.minJumpHeight;
            }

            if (dashTimer > maxDashAmount)
            {
                dashTimer = maxDashAmount;
            }

            if (active)
            {
                if (Input.GetKeyDown(DifferentKeysForJump[0]) || Input.GetKeyDown(DifferentKeysForJump[1])) //Add more if needed
                {
                    player.PlayAudio(player.audios.spindash_charge, 0.5f);

                    charging = true;
                }


                if (charging)
                {
                    dashTimer  += Time.deltaTime * chargeSpeed;
                    dashSpeed.x = dashTimer;

                    if (Input.GetKey(DifferentKeysForJump[0]) || Input.GetKey(DifferentKeysForJump[1]))
                    {
                        codedDashSpeed = dashSpeed;
                        player.PlayAudio(player.audios.peel_launch, 0.5f);

                        if (player.input.left)
                        {
                            codedDashSpeed -= codedDashSpeed * 2;
                        }
                        else if (player.input.right)
                        {
                            codedDashSpeed = dashSpeed;
                        }
                        else
                        {
                            if (player.velocity.x < 0)
                            {
                                codedDashSpeed = codedDashSpeed - codedDashSpeed * 2;
                            }
                            else if (player.velocity.x > 0)
                            {
                                codedDashSpeed = dashSpeed;
                            }
                        }
                        active          = false;
                        player.velocity = dashTarget.position - transform.position + codedDashSpeed;
                    }
                }
            }
            else if ((Input.GetKeyUp(DifferentKeysForJump[0]) || Input.GetKeyUp(DifferentKeysForJump[1])) && !charging)
            {
                active = true;
            }
        }
        else
        {
            player.state.ChangeState <WalkPlayerState>();
            player.skin.animator.SetInteger("Charge", 0);
        }
    }