//This callback is triggered when a scene has finished loading public void onSceneLoaded(Scene scene, LoadSceneMode mode) { boundary = GameObject.FindWithTag("sceneBoundary").GetComponent <sceneBoundary>() as sceneBoundary; if (instantiateOnLoadList.Count > 0) { foreach (instantiateOnLoadObject obj in instantiateOnLoadList) { if (obj.scene == "" || scene.name == obj.scene) { obj.load(); settings.objectCreated(obj.go); //Notify the sceneSettings object } } instantiateOnLoadList.RemoveAll(obj => obj.loaded == true); //Remove all of the objects that were loaded } if (player != null) { repositionCharacterOnLoad(); player.GetComponent <CharacterController2D>().sceneChangeComplete(); } settings = GameObject.FindWithTag("SceneSettings").GetComponent <sceneSettings>() as sceneSettings; global.sceneChanging = false; }
// Start is called before the first frame update void Start() { base.Start(); sceneSettingsGO = GameObject.FindWithTag("SceneSettings").GetComponent <sceneSettings>() as sceneSettings; if (!spawnTransform) { spawnTransform = container.transform; } }
// Start is called before the first frame update void Start() { global = GameObject.FindWithTag("global").GetComponent <Global>(); if (pullFromSceneSettings) { triggered = true; GameObject sgo = GameObject.FindWithTag("SceneSettings"); sceneSettings ss = sgo.GetComponent <sceneSettings>(); music = ss.music; randomizePlaylist = ss.randomizePlaylist; noSceneMusic = ss.noSceneMusic; restartIfPlaying = ss.restartIfPlaying; loopAudio = ss.loopAudio; } }
private int createSelection = 0; //This is used internally to select a random object from createObjects and start the animation before actually playing it // Start is called before the first frame update void Start() { anim = GetComponent <Animator>(); rb = GetComponent <Rigidbody2D>(); renderer = GetComponent <SpriteRenderer>(); sceneSettingsGO = GameObject.FindWithTag("SceneSettings").GetComponent <sceneSettings>() as sceneSettings; global = GameObject.FindWithTag("global").GetComponent <Global>(); if (leftTransform == null) { leftTransform = transform; } if (rightTransform == null) { rightTransform = transform; } if (rangeLeft && rangeRight) { boundXLeft = rangeLeft.position.x; boundXRight = rangeRight.position.x; } }
void Start() { global = GameObject.FindWithTag("global").GetComponent <Global>(); base.Start(); rb = gameObject.GetComponent <Rigidbody2D>() as Rigidbody2D; if (rb) { bodyTypeAtStart = rb.bodyType; } sceneSettingsGO = GameObject.FindWithTag("SceneSettings").GetComponent <sceneSettings>() as sceneSettings; renderer = gameObject.GetComponent <SpriteRenderer>() as SpriteRenderer; initialMass = rb.mass; createThrowArrow(); if (hasAction && hasActionAim) { createActionArrow(); } initialOffset = offset; initialRotationFreeze = rb.freezeRotation; initialZRotation = gameObject.transform.eulerAngles.z; }
public List <instantiateOnLoadObject> instantiateOnLoadList = new List <instantiateOnLoadObject>(); //Stores a list of objects to instantiate after the scene is fully loaded public MapSystem() { SceneManager.sceneLoaded += onSceneLoaded; settings = GameObject.FindWithTag("SceneSettings").GetComponent <sceneSettings>() as sceneSettings; }