private void Awake() { DNAScript = DNA.GetComponent <SpacerDNA>(); sr = GetComponent <SpriteRenderer>(); slot = GetComponent <DNASlot>(); holder = GetComponentInParent <SpacerHolder>(); }
//Spawns RNA that automatically dies and can't be picked up or interacted with public void SpawnFakeRNA() { Vector2 force = new Vector2(0, 30); Vector3 location = new Vector3(transform.position.x, transform.position.y + 0.8f); GameObject RNA = Instantiate(DNA, location, Quaternion.Euler(0, 0, 0)); RNA.GetComponent <BoxCollider2D>().enabled = false; SpacerDNA rnaScript = RNA.GetComponent <SpacerDNA>(); rnaScript.SetType(dnaType); rnaScript.SetSpacer(this); RNA.GetComponent <Rigidbody2D>().AddForce(force); rnaScript.StartFade(); }
public void SpawnRNA() { if (holder.CanISpawnRNA()) { if (dnaType != 0) { if (holder.isTutorialRN() && step1) { FindObjectOfType <GameController>().InitiateNextStep(); step1 = false; step2 = true; } GameObject.Find("SFXController").GetComponent <AudioButtonController>().Play("Swoosh"); holder.SetCanSpawnRNA(false); SetAsActiveCaller(true); Vector2 force = new Vector2(0, 30); Vector3 location = new Vector3(transform.position.x, transform.position.y + 0.8f); GameObject RNA = Instantiate(DNA, location, Quaternion.Euler(0, 0, 0)); SpacerDNA rnaScript = RNA.GetComponent <SpacerDNA>(); rnaScript.SetSpacer(this); //rnaScript.SetPositionInArray(position); rnaScript.SetType(dnaType); rnaScript.SetPickedToTrue(); holder.SpawnUninteractableDuplicates(); RNA.GetComponent <Rigidbody2D>().AddForce(force); if (holder.isTutorialRN() && step2) { rnaScript.AdvanceTutorial(); step2 = false; step3 = true; } else if (holder.isTutorialRN() && step3) { rnaScript.AdvanceTutorial(); rnaScript.HasAdvanced(); } /*if (count == 0) * { * myDNAs[2] = RNA; * } * AddtoCount(); * CheckCount(RNA); */ } } }