void Awake() { if (self == null) { self = this; DontDestroyOnLoad(gameObject); // Basic method to remain even after scene load } else { Destroy(gameObject); } }
// Use this for initialization protected void Start() { gameController = GameController_S.self; mainCamera = Camera_S.self.GetComponent <Camera>(); playerSprite = transform.GetChild(0).gameObject; spriteRigid = playerSprite.GetComponent <Rigidbody>(); animator = playerSprite.GetComponent <Animator>(); rigid = GetComponent <Rigidbody2D>(); canvasResources = canvas.GetComponent <Canvas_S>(); cameraShake = gameController.gameObject.GetComponent <CameraShake_S>(); invincibilityFlashTicks = (int)((invincibilitySeconds - 0.28f) / 0.16f); }
private void Start() { gameController = GameController_S.self; audioManager = AudioManager_S.self.gameObject; player = Player_S.self.gameObject; }
public void PlayGame() { GameController_S GC = GameObject.Find("Game Controller").GetComponent <GameController_S>(); GC.StartGame(); }