new void Awake() { base.Awake(); animator = GetComponent <Animator>(); rBody = GetComponent <Rigidbody2D>(); sRenderer = GetComponent <SpriteRenderer>(); player = PlayerFinder.Find(playerSceneName); originLocation = origin.transform.position; }
protected override void Awake() { base.Awake(); if (shouldExplode) { animator = GetComponent <Animator>(); } var player = PlayerFinder.Find(playerSceneName); playerUpgrades = player.GetComponent <PlayerUpgrades>(); if (playerUpgrades) { if (playerUpgrades.DiscoveredPickups.Contains(UniqueID)) { Destroy(this.gameObject); } } }
private void Load() { if (!loadStarted) { GameObject player = PlayerFinder.Find("Player"); if (player) { SceneLoader loader = new SceneLoader(loadingSceneName); loader.ScenesToUnload.Add(gameObject.scene.name); loader.Destination = destination; var upgrades = player.GetComponent <PlayerUpgrades>(); if (upgrades) { loader.GameData = upgrades.GetDataForSaving(); } else { Debug.LogWarning("Player should have PlayerUpgrades component"); } loadStarted = true; try { loader.FadeScenes(); } catch (InvalidOperationException e) { loadStarted = false; } } else { Debug.LogError($"{gameObject.name}: BreakableDoor can't find player"); } } }
public void ObtainFireAttack() { GameObject player = PlayerFinder.Find("Player"); player.GetComponent <CutsceneState>().StartCutscene(CutsceneState.UpgradeType.FireAttack, true); }
private void Awake() { player = PlayerFinder.Find("Player"); playerUpgrades = player.GetComponent <PlayerUpgrades>(); health = player.GetComponent <Health>(); }