/// <summary> /// Send References to the AI script /// </summary> /// <param name="aiControl"></param> /// <param name="rbRef"></param> /// <param name="cusPart"></param> public void GrabAIReferences(AI_Controller aiControl, Rigidbody2D rbRef, CustomParticles cusPart, AI_WallRay aiRay, TokenController token) { aiControlRef = aiControl; rb = rbRef; particlControlRef = cusPart; aiWallRay = aiRay; tokenControlRef = token; }
private void Start() { particleRef = this.gameObject; rbRef = GetComponent <Rigidbody2D>(); emitterScript = GameObject.FindObjectOfType <CustomParticles>(); // emitterScript = sourceRef.GetComponentInChildren<CustomParticles>(); playerCollisionRef = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerCollision>(); // this.transform.SetParent(sourceRef.transform); this.transform.SetParent(null); trailRef = GetComponentInChildren <TrailRenderer>(); spriteRef = GetComponentInChildren <SpriteRenderer>(); }
// Use this for initialization void Start() { //Set patrol path start = new Vector3(transform.position.x - destDist, transform.position.y); des = new Vector3(transform.position.x + destDist, transform.position.y); //Grab AI References aiRef = GetComponent <AI>(); aiControlRef = GetComponent <AI_Controller>(); customPartRef = GetComponentInChildren <CustomParticles>(); rbRef = GetComponent <Rigidbody2D>(); aiWallRayRef = GetComponentInChildren <AI_WallRay>(); playerChar = GameObject.FindGameObjectWithTag("Player").transform; tokenControl = GameObject.FindGameObjectWithTag("PlayerReferences").GetComponent <TokenController>(); ApplyAIReferences(); }
void Start () { Application.targetFrameRate = 60; shake = Camera.main.GetComponent<Shake>(); effect = Camera.main.GetComponent<effects>(); particles.transform.position = new Vector3(0,0,0); particlesControl = particles.GetComponent<CustomParticles>(); length = timeSource.clip.length; d1 = num1.GetComponent<SpriteRenderer>(); d2 = num2.GetComponent<SpriteRenderer>(); cTransform = num1.GetComponent<Transform>(); beat = GlobalData.beat; currentCount = Mathf.FloorToInt(length / beat); freq = 1.0f / timeSource.clip.frequency; timeSource.Play(); wiggleSpace = GlobalData.wiggleSpace; offBeatObjects = new GameObject[2]; offBeatObjects[0] = Instantiate(offbeat); offBeatObjects[1] = Instantiate(offbeat); offBeatObjects[0].SetActive(false); offBeatObjects[1].SetActive(false); offBeatCounter = 0; effectObject = GameObject.Find("Offbeat"); fxParticles = new GameObject[2]; fxParticles[0] = Instantiate(FXParticles); fxParticles[1] = Instantiate(FXParticles); fxParticlesControl = new CustomParticles[2]; fxParticlesControl[0] = fxParticles[0].GetComponent<CustomParticles>(); fxParticlesControl[1] = fxParticles[1].GetComponent<CustomParticles>(); switch(GlobalData.selectedGod) { case GlobalData.Gods.RHINO: fxParticlesControl[0].SetColors(rhinoColors1); fxParticlesControl[1].SetColors(rhinoColors1); break; case GlobalData.Gods.BEAR: fxParticlesControl[0].SetColors(bearColors1); fxParticlesControl[1].SetColors(bearColors1); break; case GlobalData.Gods.BULL: fxParticlesControl[0].SetColors(bullColors1); fxParticlesControl[1].SetColors(bullColors1); break; } }