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