private void OnEnable() { Test(); isFoldContent = true; compt = (PlatManager)target; isPlatShow = new List <bool>(); }
public void Awake() { instance = this; foreach (PlatHandler plat in platList) { plat.Initialize(new TakeManager()); } }
//private Camera gameCam; //private TextMesh tm; // Use this for initialization void Start() { platScript = GameObject.Find("plat_manager").GetComponent <PlatManager>(); runScript = GameObject.Find("runner").GetComponent <Runner>(); //gameCam = GameObject.Find ("MainCamera").GetComponent<Camera>(); //tm = GameObject.Find("collText").GetComponent<TextMesh>(); }
public static PlatManager Instance() { if (instance == null) { instance = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>(path)).GetComponent <PlatManager>(); DontDestroyOnLoad(instance); } return(instance); }
protected override void SelfInitalize() { InitialPlatContent(); PlatManager.Instance().AddPlatContent(_content); }
//Awake the object (Before Start) void Awake() { //Check if instance exists if (instance == null) { //If not, assign this to it. instance = this; } else if (instance != this) { //If so (somehow), destroy this object. Destroy(gameObject); } //Get List of platforms platforms = GameObject.FindGameObjectsWithTag("Platform"); platforms2 = GameObject.FindGameObjectsWithTag("Platform2"); movPlatformsVer = GameObject.FindGameObjectsWithTag("MovingVertical"); movPlatformsHor = GameObject.FindGameObjectsWithTag("MovingHorizantal"); fallThroughPlatforms = GameObject.FindGameObjectsWithTag("FallthroughPlatform"); spikes = GameObject.FindGameObjectsWithTag("Spikes"); conPlatformsLeft = GameObject.FindGameObjectsWithTag("ConveyorLeft"); conPlatformsRight = GameObject.FindGameObjectsWithTag("ConveyorRight"); //Get the spriteRenderers of each platform that changed colors platformSpriteRens = new SpriteRenderer[platforms.Length + platforms2.Length]; platMoverRens = new SpriteRenderer[movPlatformsVer.Length + movPlatformsHor.Length]; foreach (SpriteRenderer p in platformSpriteRens) { DontDestroyOnLoad(p); } foreach (SpriteRenderer p in platMoverRens) { DontDestroyOnLoad(p); } //Get Colliders to check against the player Collider platformCols = new BoxCollider2D[platforms.Length + platforms2.Length]; movPlatformsVerCols = new BoxCollider2D[movPlatformsVer.Length]; movPlatformsHorCols = new BoxCollider2D[movPlatformsHor.Length]; conPlatformsLeftCols = new BoxCollider2D[conPlatformsLeft.Length]; conPlatformsRightCols = new BoxCollider2D[conPlatformsRight.Length]; fallThroughPlatformsCols = new BoxCollider2D[fallThroughPlatforms.Length]; spikeCols = new BoxCollider2D[spikes.Length]; //Gets the Horizantal Platform Movers platMovers = new PlatMover[movPlatformsVer.Length + movPlatformsHor.Length]; for (int i = 0; i < platforms.Length; i++) { platformSpriteRens[i] = platforms[i].GetComponent <SpriteRenderer>(); } for (int i = platforms.Length; i < platformSpriteRens.Length; i++) { platformSpriteRens[i] = platforms2[i - platforms.Length].GetComponent <SpriteRenderer>(); } for (int i = 0; i < movPlatformsVer.Length; i++) { platMoverRens[i] = movPlatformsVer[i].GetComponent <SpriteRenderer>(); } for (int i = movPlatformsVer.Length; i < platMovers.Length; i++) { platMoverRens[i] = movPlatformsHor[i - movPlatformsVer.Length].GetComponent <SpriteRenderer>(); } for (int i = 0; i < platforms.Length; i++) { platformCols[i] = platforms[i].GetComponent <BoxCollider2D>(); } for (int i = platforms.Length; i < platformSpriteRens.Length; i++) { platformCols[i] = platforms2[i - platforms.Length].GetComponent <BoxCollider2D>(); } for (int i = 0; i < movPlatformsVer.Length; i++) { movPlatformsVerCols[i] = movPlatformsVer[i].GetComponent <BoxCollider2D>(); } for (int i = 0; i < movPlatformsHor.Length; i++) { movPlatformsHorCols[i] = movPlatformsHor[i].GetComponent <BoxCollider2D>(); } for (int i = 0; i < spikes.Length; i++) { spikeCols[i] = spikes[i].GetComponent <BoxCollider2D>(); } for (int i = 0; i < conPlatformsLeft.Length; i++) { conPlatformsLeftCols[i] = conPlatformsLeft[i].GetComponent <BoxCollider2D>(); } for (int i = 0; i < conPlatformsRight.Length; i++) { conPlatformsRightCols[i] = conPlatformsRight[i].GetComponent <BoxCollider2D>(); } for (int i = 0; i < fallThroughPlatforms.Length; i++) { fallThroughPlatformsCols[i] = fallThroughPlatforms[i].GetComponent <BoxCollider2D>(); } for (int i = 0; i < platMovers.Length; i++) { if (i < movPlatformsVer.Length) { //Ensure the player is in the center of the square platMovers[i] = movPlatformsVer[i].GetComponent <PlatMover>(); } else { if (platforms2 != null) { platMovers[i] = movPlatformsHor[i - movPlatformsVer.Length].GetComponent <PlatMover>(); } } } //where the soundy things are leftMove = Resources.Load("Sounds/Bing") as AudioClip; rightMove = Resources.Load("Sounds/Bing") as AudioClip; movingPlats = new AudioClip[] { Resources.Load("Sounds/digibits") as AudioClip, Resources.Load("Sounds/digibits") as AudioClip }; }