*
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class PlatformChemistry : MonoBehaviour {
|
||||
public Material normalStateMaterial;
|
||||
public Material enterStateMaterial;
|
||||
private GameManager gameManager;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
gameManager = GameObject.FindObjectOfType<GameManager> ();
|
||||
renderer.sharedMaterial = normalStateMaterial;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider other){
|
||||
var c = other.gameObject.GetComponent<BallController> ();
|
||||
if (c != null) {
|
||||
renderer.sharedMaterial = enterStateMaterial;
|
||||
if(gameManager != null){
|
||||
gameManager.ActivateChemistry();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerExit(Collider other){
|
||||
var c = other.gameObject.GetComponent<BallController> ();
|
||||
if (c != null) {
|
||||
renderer.sharedMaterial = normalStateMaterial;
|
||||
if(gameManager != null){
|
||||
gameManager.DeactivateChemistry();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user