Example #1
0
 // When this code is disabled, switch back to the other UI.
 void OnDisable()
 {
     ar = null;
     topChargeBar.fillAmount = 0;
     botChargeBar.fillAmount = 0;
     flashing = false;
     kirbySpeedometer.enabled = true;
     speedometer.enabled      = false;
     speedometerNums.SetActive(false);
     HPBar.SetActive(false);
 }
Example #2
0
    // When triggered, gives stats based on what type of stat it was, and destroys itself.
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "KirbyMachine")
        {
            // Updates Kirby's Stat Page
            if (sp.getStatID() == 0)
            {
                ks.allPatch();
            }
            if (sp.getStatID() == 1)
            {
                ks.boostPatch();
            }
            if (sp.getStatID() == 2)
            {
                ks.chargePatch();
            }
            if (sp.getStatID() == 3)
            {
                ks.defensePatch();
            }
            if (sp.getStatID() == 4)
            {
                ks.glidePatch();
            }
            if (sp.getStatID() == 5)
            {
                ks.HPPatch();
            }
            if (sp.getStatID() == 6)
            {
                ks.offensePatch();
            }
            if (sp.getStatID() == 7)
            {
                ks.topSpeedPatch();
            }
            if (sp.getStatID() == 8)
            {
                ks.turnPatch();
            }
            if (sp.getStatID() == 9)
            {
                ks.weightPatch();
            }

            sn.SetStat(sp.getStatID());
            ar = col.gameObject.GetComponent <AirRide> ();
            ar.statBoost(sp.getStatID());
            Destroy(gameObject);
        }
    }
Example #3
0
    // Jumping off of the Air Ride
    private IEnumerator JumpOffStar()
    {
        // Kirby no longer dependent on vehicle, and vice versa.
        airRide.transform.parent = null;
        airRide.gameObject.tag   = "AirMachine";
        ar.charge = 0;
        ar.resetRotation();
        ar         = null;
        onStar     = false;
        jumpCharge = 0;


        cam.transform.parent = null;
        cam.GetComponent <CameraControl> ().enabled = true;


        // Make all vehicle stats go back

        // Resetting particle effects for vehicles.
        if (jsp != null)
        {
            jsp.StopParticles();
            jsp = null;
        }
        if (sse != null)
        {
            sse.StopParticles();
            sse = null;
        }


        // Undo UI for vehicles
        ui.enabled = false;

        // Jumps Kirby Up, for a "Pop off" effect.
        rb.velocity += Vector3.up * moveSpeed * Time.deltaTime;

        // He isn't charging anymore, so appropriate the animations.
        anim.SetBool("Charging", false);
        anim.SetBool("JumpingOff", true);
        anim.SetBool("Jumping", false);
        anim.SetBool("Jumping2", false);
        anim.SetBool("Riding", false);

        // Don't re-enable his sphere collider for a few seconds so he won't instantly hop back on a ride.
        yield return(new WaitForSeconds(1f));

        sphereCol.enabled = true;
        anim.SetBool("JumpingOff", false);
    }
Example #4
0
    private void OnDrawGizmos()
    {
        if (!mGizmoSwitch)
        {
            return;
        }
        AccessToResources();
        AirRide         gizmosAirRide = new AirRide(transform, mRayConfig.GetAirRideRayConfig, mVehicleSettings.GetAirRideSettings);
        DirectionFixRay dirFixRay     = new DirectionFixRay(transform, mRayConfig.GetDirectionFixRayConfig);

        dirFixRay.DrawGizmos();
        gizmosAirRide.DrawGizmos();
        LRRay lrRay = new LRRay(transform, mRayConfig.GetLRRayConfig);

        lrRay.DrawRayGizmos();
        DriftScript ds = new DriftScript(mVehicleSettings.GetDriftSettings);

        ds.OnDrawGimos(transform, GetComponent <Rigidbody>());
    }
Example #5
0
 // If hit from Kirby, reduce HP using an algorithm derived from speed, weight, and offensive abilities of the air Ride.
 // Also if the player is spinning, do some extra damage.
 void OnCollisionEnter(Collision col)
 {
     if (col.gameObject.tag == "Kirby")
     {
         playerMachine = col.gameObject.GetComponent <KirbyWalk> ().getAirRideGameObject();
         if (playerMachine == null)
         {
             print("nope!");
         }
         ar = playerMachine.GetComponent <AirRide> ();
         if (ar == null)
         {
             print("nope!");
         }
         curHP     -= ((ar.acceleration * ar.topSpeed) * (ar.offense * 1.2f) * (ar.weight * 1.05f));
         playerAnim = player.GetComponent <Animator> ();
         if (playerAnim.GetBool("Spinning"))
         {
             curHP -= 10;
         }
     }
 }
Example #6
0
    // Edits the variables to assign Kirby's ride.
    IEnumerator RiderOn(GameObject g)
    {
        yield return(new WaitForSeconds(0.6f));

        g.transform.SetParent(this.transform);
        jumpingOnStar = false;
        onStar        = true;
        anim.SetBool("Riding", true);
        anim.SetBool("Hopping on", false);
        rb.isKinematic = false;
        if (jsp != null)
        {
            jsp.StartParticles();
        }
        if (sse != null)
        {
            sse.StartParticles();
        }

        ar         = g.GetComponent <AirRide> ();
        ui.enabled = true;
        airRide    = g.gameObject;
    }
Example #7
0
    private void Initialize()
    {
        AccessToResources();
        //ユーザーの入力を取得
        mPlayerInput           = GetComponent <IPlayerInput>();
        mRigidbody             = GetComponent <Rigidbody>();
        mDataUiCarModel        = FindObjectOfType <DataUiCarModel>();
        mGameSceneManager      = FindObjectOfType <GameSceneManager>();
        mRigidbody.constraints = RigidbodyConstraints.FreezeRotation;
        mRigidbody.useGravity  = false;
        mInitializer           = new TransformInitializer(transform);
        //エンジン内で使用する計算クラス
        EngineSpeedCalc engineCalc = new EngineSpeedCalc(mVehicleSettings.GetEngineSettings, mVehicleSettings.GetPenaltySettings, mGearParam, mPlayerInput.GetCurrentGear);

        //エンジンを初期化
        mEngine = new Engine(engineCalc, mRigidbody, gameObject.FindObjectOfInterface <IGearManageable>(), mPlayerInput.GetCurrentGear);

        mVehicleMove = new VehicleMove(mRigidbody, transform, mWheelParams,
                                       mVehicleSettings.GetDriftSettings, mVehicleSettings.GetSteerSensitivities);
        mAirRide      = new AirRide(transform, mRayConfig.GetAirRideRayConfig, mVehicleSettings.GetAirRideSettings);
        mDirFix       = new DirectionFix(transform, mRayConfig.GetDirectionFixRayConfig);
        mAIPenaltyRay = new DirectionFixRay(transform, mRayConfig.GetDirectionFixRayConfig);
        mWallHitCheck = new WallHitCheck(transform, mRayConfig.GetLRRayConfig);
    }
Example #8
0
    // Update is called once per frame
    void Update()
    {
        #region General
        if (ar == null)
        {
            ar = player.GetComponent <KirbyWalk> ().getAirRide();
        }

        #endregion General

        #region ChargeBar

        // Sets the fill and color of charge bar based on the amount that is full. I like this code.
        if (ar.charge < 100)
        {
            topChargeBar.fillAmount = (ar.charge / 100);
            topChargeBar.color      = rainbow.Evaluate(ar.charge / 100);

            botChargeBar.fillAmount = (ar.charge / 100);
            botChargeBar.color      = rainbow.Evaluate(ar.charge / 100);
        }

        if (ar.charge == 100 && !flashing)
        {
            flashing = true;
        }

        if (ar.charge == 0)
        {
            flashing     = false;
            startedFlash = false;
        }

        if (flashing && !startedFlash)
        {
            StartCoroutine(Flash());
            startedFlash = true;
        }

        #endregion ChargeBar

        #region SpeedText
        if (Time.time > updateDelayStart)
        {
            speed = ar.acceleration * ar.topSpeed;
            //print ("I think speed is: " + speed);
            speed1.text = Mathf.Floor(speed).ToString().PadLeft(3, '0');
            //print (speed.ToString("000"));
            float decimalPart = speed - Mathf.Floor(speed);
            speed2.text       = decimalPart.ToString("F2").Substring(1);;
            updateDelayStart += updateDelay;
        }


        #endregion SpeedText

        #region HP

        //maxHPBar.rectTransform.sizeDelta = new Vector2 (60, ar.maxHP + 20);



        #endregion HP
    }
Example #9
0
 void Start()
 {
     ar = gameObject.GetComponent <AirRide> ();
 }