hello , i made this script and when i press button it should made 1 flame at cube,but when i press button it creates a lot of flames and that slow my computer,and it looks bad…can anyone help me ,thanks
if(Village_Looted) {
var looted = Instantiate(Village_Fire,
GameObject.Find("FirePoint").transform.position,
Quaternion.identity);
}
here is completed code
var Village_Looted:boolean = false; //village looted da ili ne
var Village_Menu:boolean = false; //
var Show_Peasants_Inventory:boolean = false; //torba seljaka
var Show_Hostile_Action_Menu:boolean = false; //neprijateljski akcija
var Village_Name:String; //ime sela
var Village_Description:String; // opis sela
var Populace:int; //popularnost
var Background_Texture:Texture2D; //background texture
var Player:Transform; //Igrach
var Village_Position:Transform; //pozicija sela
var Village_Fire:Transform;
function OnMouseDown() {
Village_Menu = true;
}
function OnGUI() {
if(Village_Menu) {
GUI.Label(new Rect(20, 20, Screen.width, 1000), Background_Texture);
if(GUI.Button(new Rect(20, 20, 40, 40), "Go To The Village Center.")) {
Player.position = Village_Position.position;
Village_Menu = false;
}
if(GUI.Button(new Rect(40, 40, 40, 40), "Buy Supplies From Peasants.")) {
Show_Peasants_Inventory = true;
Village_Menu = false;
}
if(GUI.Button(new Rect(60, 60, 40, 40), "Take A Hostile Action.")) {
Show_Hostile_Action_Menu = true;
Village_Menu = false;
}
if(GUI.Button(new Rect(80, 80, 40, 40), "Leave...")) {
Village_Menu = false;
}
}
if(Village_Looted) {
var looted = Instantiate(Village_Fire,
GameObject.Find("FirePoint").transform.position,
Quaternion.identity);
}
if(Show_Hostile_Action_Menu)
if(GUI.Button(new Rect(20, 20, 40, 40), "Loot and Burn This Village")) {
Village_Looted = true;
Show_Hostile_Action_Menu = false;
}
}