Modif scene Antoine

This commit is contained in:
unknown 2015-08-13 15:25:25 -04:00
parent 29352dba1b
commit 2911b3aaf3
2 changed files with 7 additions and 4 deletions

View File

@ -3,7 +3,7 @@ using System.Collections;
public class ConstructionBehaviour : MonoBehaviour { public class ConstructionBehaviour : MonoBehaviour {
public int ConstructionType; public int ConstructionType =-1 ;
public GameObject maisonHumain; public GameObject maisonHumain;
public GameObject maisonZombie; public GameObject maisonZombie;
public GameObject champ; public GameObject champ;
@ -11,6 +11,7 @@ public class ConstructionBehaviour : MonoBehaviour {
void OnMouseDown() void OnMouseDown()
{ {
int.TryParse(Input.inputString, out ConstructionType);
switch (ConstructionType) { switch (ConstructionType) {
case 1: case 1:
SwitchPrefab = maisonHumain; SwitchPrefab = maisonHumain;
@ -22,14 +23,16 @@ public class ConstructionBehaviour : MonoBehaviour {
SwitchPrefab = maisonZombie; SwitchPrefab = maisonZombie;
break; break;
default: default:
SwitchPrefab = maisonHumain; SwitchPrefab = null;
break; break;
} }
switchPrefab (); switchPrefab ();
} }
void switchPrefab() void switchPrefab()
{ {
if (SwitchPrefab != null) {
Instantiate (SwitchPrefab, this.gameObject.transform.position, this.gameObject.transform.rotation); Instantiate (SwitchPrefab, this.gameObject.transform.position, this.gameObject.transform.rotation);
DestroyObject (this.gameObject); DestroyObject (this.gameObject);
} }
} }
}