Created
June 9, 2016 02:45
-
-
Save Sposito/03740ce86f7c367bada1b1535444fb9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// >>>>>>>>>>>>Player Controller.cs<<<<<<<<<< | |
//... | |
public void BoostSpeed(float duration, float factor){ | |
StartCoroutine (BoostCoroutine(duration,factor)); | |
} | |
private IEnumerator BoostCoroutine(float duration, float factor){ | |
boostFactor *= factor; | |
rend.materials [2].color = boostColor; | |
yield return new WaitForSeconds (duration); | |
boostFactor /= factor; | |
rend.materials [2].color = baseColor; | |
} | |
} | |
//<<<<<<<<<Boost.cs >>>>>>> | |
public float duration = 5f; | |
public float factor = 1.6f; | |
PlayerController pController; | |
void Start () { | |
pController = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerController> (); | |
} | |
void OnTriggerEnter(Collider col){ | |
pController.BoostSpeed (duration, factor); | |
Destroy (gameObject); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment