void Start() { char1 = PlayerPrefs.GetInt("wandererSelect"); char2 = PlayerPrefs.GetInt("archerSelect"); char3 = PlayerPrefs.GetInt("unknownSoldierSelect"); if (char1 == 1) { wanderer.SetActive(true); archer.SetActive(false); unknownSoldier.SetActive(false); } else if (char2 == 1) { archer.SetActive(true); wanderer.SetActive(false); unknownSoldier.SetActive(false); } else if (char3 == 1) { unknownSoldier.SetActive(true); wanderer.SetActive(false); archer.SetActive(false); } spawner = Spawner.GetComponent <spawn>(); wan = wanderer.GetComponent <Wanderer>(); arc = archer.GetComponent <Archer>(); us = unknownSoldier.GetComponent <UnknownSoldier>(); Time.timeScale = 1; }
void Start() { gameSc = GameObject.Find("GameControl").GetComponent <gameControl>(); spawnSc = GameObject.Find("GameControl").GetComponent <spawn>(); playerSc = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); Audio = GetComponent <AudioSource>(); Audio.volume = PlayerPrefs.GetFloat("AudioVolume", 0.5f); }
void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("player")) { Debug.Log("Triggered"); CurrentSpawnZone = this; } }
// Start is called before the first frame update void Start() { _shield = transform.GetChild(0).gameObject; _tripleyolo = transform.GetChild(1).gameObject; transform.position = new Vector3(0f, -5.51f, 0f); _spawnmangaer = GameObject.Find("Spawn_Mannager").GetComponent <spawn>(); _uImanager = FindObjectOfType <UIManager>(); _anim = GetComponent <Animator>(); }
public void GameStart() { spawn spawnEvent = new spawn(SpawnPlayer); StartCoroutine(mapGenerator.MapGenerate(spawnEvent)); nowClip = normal; audio.clip = nowClip; audio.Play(); }
public void SpawnBoids(float x, float y, float radius, int amount) { spawn k = new spawn(); k.x = x; k.y = y; k.rad = radius; k.amount = amount; spawner.Add(k); }
void SetMyLaneSpawner() { spawn[] spawnerArray = GameObject.FindObjectsOfType <spawn> (); foreach (spawn child in spawnerArray) { if (child.transform.position.y == transform.position.y) { myLane = child; } } }
public void TurnOnOrOff(string name, bool OnOff) { spawn s = Array.Find(spawns, sound => sound.name == name); if (s != null) { Debug.LogError("Sound: " + name + " not found!"); return; } s.OnOff = OnOff; }
void FixedUpdate() { foreach (DefBlockTrigger d in spawnList) { if (Mathf.Abs(timerScript.currentTime - d.timeStamp) < 0.01f) { GameObject spawn = GameObject.Find(d.block + "_spawn"); spawn spawnScript = spawn.GetComponent <spawn> (); spawnScript.Spawn(); } } }
IEnumerator SpawnWave(spawn _spawn) { Debug.Log("SPawning wave"); state = SpawnState.Spawning; //spawn for (int i = 0; i < _spawn.count; i++) { SpawnCat(); yield return(new WaitForSeconds(1f / _spawn.rate)); } state = SpawnState.Waiting;//waits for player to kill enemies yield break; }
// Start is called before the first frame update void Start() { spawner = Spawner.GetComponent <spawn>(); }
public void OnClick() { GameObject[] save = GameObject.FindGameObjectsWithTag("Lighter"); try { NpgsqlConnection conn = new NpgsqlConnection("Server=127.0.0.1;User Id=postgres;Password=12345;Database=lighters;"); conn.Open(); string sql = "Delete From properties"; NpgsqlCommand com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); sql = "ALTER SEQUENCE properties_id_seq RESTART WITH 1"; com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); for (int i = 0; i < save.Length; i++) { Timer t = save[i].GetComponent <Timer>(); sql = "Insert Into properties (rot, coor, \"time\", side, red) Values (" + (int)save[i].transform.rotation.eulerAngles.y + ",'{" + (int)save[i].transform.position.x + "," + (int)save[i].transform.position.y + "," + (int)save[i].transform.position.z + "}','{" + (int)t.g + "," + (int)t.r + "}'," + save[i].GetComponent <road>().s + "," + t.red + ")"; com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); } sql = "Delete From walls"; com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); sql = "ALTER SEQUENCE public.\"walls_id _seq\" RESTART WITH 1"; com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); save = GameObject.FindGameObjectsWithTag("Wall"); for (int i = 0; i < save.Length; i++) { sql = "Insert Into walls (rot, coor, scale) Values (" + (int)save[i].transform.rotation.eulerAngles.y + ",'{" + (int)save[i].transform.position.x + "," + (int)save[i].transform.position.y + "," + (int)save[i].transform.position.z + "}','{" + (int)save[i].transform.localScale.x + "," + (int)save[i].transform.localScale.y + "," + (int)save[i].transform.localScale.z + "}')"; com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); } sql = "Delete From stops"; com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); sql = "ALTER SEQUENCE public.\"stops_id_seq\" RESTART WITH 1"; com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); save = GameObject.FindGameObjectsWithTag("Stop"); for (int i = 0; i < save.Length; i++) { sql = "Insert Into stops (rot, coor, name) Values (" + (int)save[i].transform.rotation.eulerAngles.y + ",'{" + (int)save[i].transform.position.x + "," + (int)save[i].transform.position.y + "," + (int)save[i].transform.position.z + "}','" + save[i].name + "')"; com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); } sql = "Delete From spawn"; com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); sql = "ALTER SEQUENCE public.spawn_id_seq RESTART WITH 1"; com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); save = GameObject.FindGameObjectsWithTag("Spawn"); for (int i = 0; i < save.Length; i++) { spawn s = save[i].GetComponent <spawn>(); sql = "Insert Into spawn (rot, coor, num) Values (" + (int)save[i].transform.rotation.eulerAngles.y + ",'{" + (int)save[i].transform.position.x + "," + (int)save[i].transform.position.y + "," + (int)save[i].transform.position.z + "}'," + s.num + ")"; com = new NpgsqlCommand(sql, conn); com.ExecuteNonQuery(); } conn.Close(); } catch { MessageBox.Show("Server is off or busy", "Server Error", MessageBoxButtons.OK); } }
void Awake() { Instance = this; }
void Start() { spawnSc = GetComponent <spawn>(); stats = statObject.GetComponent <Stats>(); }
// Use this for initialization void Awake() { _velcroList = new List <GameObject>(); _floorList = new List <GameObject>(); _current = this; }
// Start is called before the first frame update void Start() { spawner = Spawner.GetComponent <spawn>(); bossEnemy = boss.GetComponent <bossScript>(); }
public void setSpawner(spawn spawn) { _spawn = spawn; }
void Start() { try { conn = new NpgsqlConnection("Server=127.0.0.1;User Id=postgres;Password=12345;Database=lighters;"); conn.Open(); string sql = "select * from properties"; NpgsqlCommand com = new NpgsqlCommand(sql, conn); NpgsqlDataReader reader; reader = com.ExecuteReader(); string result, resulti; object result1 = 0, result2 = 0, result3 = true, result4 = true; while (reader.Read()) { result = reader.GetValue(1).ToString(); //rotation result1 = reader.GetValue(2); //position result2 = reader.GetValue(3); //time result3 = reader.GetValue(4); //side result4 = reader.GetValue(5); //red int[] a = (int[])result1; int[] b = (int[])result2; bool s = (bool)result3; bool red = (bool)result4; l = (GameObject)Instantiate(prefab, new Vector3(a[0], a[1], a[2]), Quaternion.AngleAxis(int.Parse(result), Vector3.up)); Timer t = l.GetComponent <Timer>(); t.g = b[0]; t.r = b[1]; l.GetComponent <road>().s = s; t.red = red; l.name = l.name + i; i++; } i = 0; sql = "select * from spawn"; com = new NpgsqlCommand(sql, conn); reader = com.ExecuteReader(); while (reader.Read()) { result = reader.GetValue(1).ToString(); //rotation result1 = reader.GetValue(2); //position result2 = reader.GetValue(3); //num int[] a = (int[])result1; int b = (int)result2; l = (GameObject)Instantiate(prefab1, new Vector3(a[0], a[1], a[2]), Quaternion.AngleAxis(int.Parse(result), Vector3.up)); spawn t = l.GetComponent <spawn>(); t.num = b; l.name = l.name + i; i++; } sql = "select * from stops"; com = new NpgsqlCommand(sql, conn); reader = com.ExecuteReader(); while (reader.Read()) { resulti = reader.GetValue(0).ToString(); //id result = reader.GetValue(1).ToString(); //rotation result1 = reader.GetValue(2); //position int[] a = (int[])result1; int b = (int)result2; l = (GameObject)Instantiate(prefab2, new Vector3(a[0], a[1], a[2]), Quaternion.AngleAxis(int.Parse(result), Vector3.up)); l.name = "stop" + resulti; } sql = "select * from route"; com = new NpgsqlCommand(sql, conn); reader = com.ExecuteReader(); while (reader.Read()) { result = reader.GetValue(1).ToString(); //name result1 = reader.GetValue(2); //route string[] a = (string[])result1; l = (GameObject)Instantiate(prefab3); l.name = result.ToString(); l.GetComponent <route>().m = a; } } catch { MessageBox.Show("Server is off or busy", "Server Error", MessageBoxButtons.OK); UnityEngine.Application.Quit(); } }
public void runFunct(int cp) { //Debug.Log("looking for player " + cp); GameObject curPlayer = findCurPlayer(cp); GameObject hand = GameObject.Find("Function"); numPlayers = ButtonManager.numPlayers; foreach (Transform child in hand.transform) { //Debug.Log("child count = " + hand.transform.childCount); int parent = Convert.ToInt32(curPlayer.transform.parent.name); Vector3 curRot = curPlayer.transform.transform.eulerAngles; Debug.Log("curRot = " + curRot); string tag = child.tag; if (tag == "Forward") { moveForward(curPlayer, parent, curRot); } else if (tag == "Left") { turn(curPlayer, 0, curRot); } else if (tag == "Right") { turn(curPlayer, 1, curRot); } else if (tag == "Laser") { fireLaser(curPlayer, parent, curRot); } else if (tag == "FCard") { //Debug.Log("trying to run function card"); GameObject FCard = GameObject.Find("FCard"); //Debug.Log(FCard.transform.childCount); foreach (Transform c in FCard.transform) { parent = Convert.ToInt32(curPlayer.transform.parent.name); curRot = curPlayer.transform.transform.eulerAngles; //Debug.Log(c.tag); if (c.tag == "Forward") { moveForward(curPlayer, parent, curRot); } else if (c.tag == "Left") { turn(curPlayer, 0, curRot); } else if (c.tag == "Right") { turn(curPlayer, 1, curRot); } else if (c.tag == "Laser") { fireLaser(curPlayer, parent, curRot); } } } GameObject.Destroy(child.gameObject); } spawn s = new spawn(); //Debug.Log("end runFunc"); Scene sc = SceneManager.GetActiveScene(); if (sc.name != "spgameBoard2") { spawn.updateStats(); } s.SwitchTurn(cp); /* * 1 2 3 4 5 6 7 8 * 9 10 11 12 13 14 15 16 * 17 18 19 20 21 22 23 24 * 25 26 27 28 29 30 31 32 * 33 34 35 36 37 38 39 40 * 41 42 43 44 45 46 47 48 * 49 50 51 52 53 54 55 56 * 57 58 59 60 61 62 63 64 */ }