// Update is called once per frame void Update() { if (resetNextFrame) { actifP = null; actifS = null; resetNextFrame = false; } if (estValableS) { /* * texture = GetComponent * mesh.material.mainTexture = */ GetComponent <Renderer>().material.color = Color.yellow; } else { if (estValableP) { GetComponent <Renderer>().material.color = Color.green; } else if (lockActive) { GetComponent <Renderer>().material.color = Color.cyan; } else { GetComponent <Renderer>().material.color = Color.white; } } }
private void OnCollisionEnter(Collision collision) { if (lockActive) { return; } if (collision.gameObject.name == "Grimace2.0") { if (estValableS) { actifS = this; if (actifP && actifS) { lockActive = true; actifS.setTuileSuivante(); actifP.setTuileSuivante(); } } else { collision.gameObject.GetComponent <DeplacementAllie>().estMort = true; } } if (collision.gameObject.name == "Jacob4.0") { if (estValableP) { actifP = this; if (actifP && actifS) { lockActive = true; actifS.setTuileSuivante(); actifP.setTuileSuivante(); } } else { collision.gameObject.GetComponent <DeplacementJacob>().estMort = true; } } }
public void OnCollisionExit(Collision collision) { if (lockActive) { return; } if (collision.gameObject.name == "Grimace2.0") { if (actifS) { actifS = null; } } if (collision.gameObject.name == "Jacob4.0") { if (actifP) { actifP = null; } } }