private void Start() { gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); smokeManager = GameObject.FindGameObjectWithTag("SmokeManager").GetComponent <SmokeManager>(); }
private void Start() { smokeManager = GameObject.FindGameObjectWithTag("SmokeManager").GetComponent <SmokeManager>(); spriteComponant = GetComponent <SpriteRenderer>(); }
void effectsController() { if (carSmoking == true && carSmoke == null) { if (sm == null) { sm = this.gameObject.AddComponent <SmokeManager> (); } sm.smokeOriginPoint = enginePoint.transform.position; carSmoke = (GameObject)Instantiate(CommonObjectsStore.me.smokeEffect, enginePoint.transform); carSmoke.GetComponent <SmokeEffect> ().myManager = sm; } if (carFireEffect == null) { carFireEffect = new List <GameObject> (); } if (carMinorFire == true && carFireEffect.Count < 2) { for (int x = 0; x < 2; x++) { GameObject g = (GameObject)Instantiate(CommonObjectsStore.me.carFireEffect, enginePoint.transform); g.transform.localPosition = new Vector3(Random.Range(-0.25f, 0.25f), Random.Range(-0.25f, 0.25f), 0); g.transform.localScale = new Vector3(Random.Range(0.1f, 0.4f), Random.Range(0.1f, 0.4f), 0); carFireEffect.Add(g); } } if (carMajorFire == true && carFireEffect.Count < 7) { while (carFireEffect.Count < 7) { GameObject g = (GameObject)Instantiate(CommonObjectsStore.me.carFireEffect, enginePoint.transform); g.transform.localPosition = new Vector3(Random.Range(-0.25f, 0.25f), Random.Range(-0.25f, 0.25f), 0); g.transform.localScale = new Vector3(Random.Range(0.7f, 1.0f), Random.Range(0.7f, 1.0f), 0); carFireEffect.Add(g); } } if (carExploding == true) { explodeTimer -= Time.deltaTime; if (explodeTimer <= 0) { Vector3 pos = new Vector3(Random.Range(this.transform.position.x - 1, this.transform.position.x + 1), Random.Range(this.transform.position.y - 1, this.transform.position.y + 1), 0); GameObject g = (GameObject)Instantiate(CommonObjectsStore.me.grenadeExplosion, pos, Quaternion.Euler(0, 0, 0)); g.GetComponent <SpriteRenderer> ().sortingOrder = 12; explodeTimer = Random.Range(1.0f, 5.0f); this.gameObject.GetComponentInChildren <SpriteRenderer> ().color = new Color(0.5f, 0.5f, 0.5f, 1); if (myRoadFollower == null) { } else { if (myRoadFollower.hasDriver == true) { GameObject g2 = (GameObject)Instantiate(CommonObjectsStore.me.civilian, driversDoor.transform.position, Quaternion.Euler(0, 0, 0)); NPCController npc = g2.GetComponent <NPCController> (); NPCBehaviourDecider npcb = g2.GetComponent <NPCBehaviourDecider> (); NPCMemory npcm = g2.GetComponent <NPCMemory> (); npcm.beenAttacked = true; npcm.seenSuspect = true; //npcm.objectThatMadeMeSuspisious = CommonObjectsStore.player; npcm.raiseAlarm = true; npcb.alarmed = true; } myRoadFollower.hasDriver = false; } } } }
private void Awake() { Instance = this; ding = GetComponent <AudioSource>(); }