public void SetData(int time, LvlController controller, int score) { this.time = time; this.controller = controller; SetTimer(); SetScore(score); StartCoroutine(GameTime()); }
private void Awake() { if (Instance == null) { Instance = this; } else if (Instance == this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); StartNewGame(); }
public override void Trigger() { float rand = UnityEngine.Random.Range(0, 100); if (rand <= percentChance) { switch (spawnType) { //Random case SpawnType.Random: LvlController lvl = GameMaster.instance.lvlMan; float x = UnityEngine.Random.Range(lvl.minX, lvl.maxX); float y = UnityEngine.Random.Range(lvl.minY, lvl.maxY); GameObject randomSpawn = Instantiate(ObjToSpawn, new Vector2(x, y), Quaternion.identity); break; //OnPlayer case SpawnType.OnPlayer: GameObject onPlayerSpawn = Instantiate(ObjToSpawn, target.transform.position, Quaternion.identity); break; } Debug.Log(perkName + ": TRIGGERED"); } if (triggerType == TriggerType.OneTime) { switch (spawnType) { //Random case SpawnType.Random: LvlController lvl = GameMaster.instance.lvlMan; float x = UnityEngine.Random.Range(lvl.minX, lvl.maxX); float y = UnityEngine.Random.Range(lvl.minY, lvl.maxY); GameObject randomSpawn = Instantiate(ObjToSpawn, new Vector2(x, y), Quaternion.identity); break; //OnPlayer case SpawnType.OnPlayer: Debug.Log("SPAWN ON PLAYER: " + curPlayer); GameObject onPlayerSpawn = Instantiate(ObjToSpawn, target.transform.position, Quaternion.identity); onPlayerSpawn.GetComponent <SpawnableObject>().phand = curPlayer; break; } } }
public void Init(LvlController contr, int count, GameObject objects, Boundary coord, bool side = false) { controller = contr; countObjects = count; objectsPrefab = objects; coordinates = new Boundary(); if (side) { isNegative = true; coordinates.xCoord = coord.xCoord * -1; } else { coordinates.xCoord = coord.xCoord; } coordinates.yMin = coord.yMin; coordinates.yMax = coord.yMax; InstObj(); }
public void SetLvlC(LvlController controller) { this.controller = controller; }
void Awake() { Instance = this; }