void Awake() { // Time button cameraGrey = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraGrey>(); // shader stoppableObjectManager = GameObject.FindGameObjectWithTag("StoppableObjectManager").GetComponent <StoppableObjectManager>(); // manager timeGUI = Resources.FindObjectsOfTypeAll <TimeGUI>()[0] as TimeGUI; // Animation spriteRenderer = GetComponent <SpriteRenderer>(); // Sprite flip X rb = GetComponent <Rigidbody2D>(); // physics animator = GetComponent <Animator>(); // Animator // Item collection bag = GetComponent <Bag>(); // Bonus room movableCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MovableCamera>(); countDown = Resources.FindObjectsOfTypeAll <CountDown>()[0] as CountDown; // Falling gravity = Physics.gravity.y; // fall force boxCollider2D = GetComponent <BoxCollider2D>(); // raycast width sceneHeight = GameObject.FindGameObjectWithTag("OuterBorder").GetComponent <OuterBorder>().BorderHeight(); // Sound play // soundManager = GameObject.FindGameObjectWithTag("SoundManager").GetComponent<SoundManager>(); soundManager = GetComponent <SoundManager>(); }
protected virtual void OnEnable() { if (stoppableObjectManager == null) { stoppableObjectManager = GameObject.FindGameObjectWithTag("StoppableObjectManager").GetComponent <StoppableObjectManager>(); } stoppableObjectManager.AddObject(this); // Get Player if (player == null) { player = GameObject.FindGameObjectWithTag("Player").transform; } // playerCollider = player.gameObject.GetComponent<Collider2D>(); EnableSetting(); // Custom }