示例#1
0
    // Update is called once per frame
    void FixedUpdate()
    {
//        if (Input.GetKeyDown(inputKey))
//        {
//            onOff = !onOff;
//        }

        if (onOff)
        {
            myRB.AddForceAtPosition(-transform.up * forceScalar, transform.position, ForceMode.Force);
            mySR.color = new Color(mySR.color.r, mySR.color.g, mySR.color.b, Random.Range(.2f, 1f));
            myEM.EnergyConsume(energyConsumeRate * Time.deltaTime);
        }
        else
        {
            mySR.color = new Color(mySR.color.r, mySR.color.g, mySR.color.b, 0);
        }
    }
示例#2
0
 void FixedUpdate()
 {
     myRB.AddForce(transform.forward * (mEFactorApplied) * boostFactor);
     myEM.EnergyConsume(Mathf.Abs(mEFactorApplied) * maxEnergyConsumeRate * Time.fixedDeltaTime);
     //Debug.Log(mEFactorApplied * maxEnergyConsumeRate * Time.fixedDeltaTime);
 }