// Start is called before the first frame update void Start() { WayPointMap = EnemySettings.GetWayPoints(); DeadlyWayPointMap = EnemySettings.GetSuicideWayPoints(); transform.position = WayPointMap[WaypointIndex].transform.position; //the initail position is the first index point EnemyData = gameObject.GetComponent <PH_Enemy>(); //script from the same object session = FindObjectOfType <PH_GameSession>(); //game session for this scene }
private void Start() { eventSystem = FindObjectOfType <EventSystem>(); pauseScreen.SetActive(false); StartGameScreen.SetActive(true); Time.timeScale = 0;//pause at the beginning of the scene Player = FindObjectOfType <PH_PlayerController>(); gameSession = FindObjectOfType <PH_GameSession>(); }
void Start() { CameraBounderies(); BowMovement = GetComponent <Animator>(); //to control the bow animation Spawner = FindObjectOfType <PH_EnemySpawner>(); //find all those elements in the scene PauseController = FindObjectOfType <PH_Pause>(); gameSession = FindObjectOfType <PH_GameSession>(); sceneLoader = FindObjectOfType <PH_SceneLoader>(); float healthBonus = ((gameSession.GetMaxLives() - gameSession.GetCurrentLives()) * 1f / gameSession.GetMaxLives()) / 2; health = startingHealth *= (1 + healthBonus);//calculate bonus health, +10% for each lost heart }
PH_GameSession gameSession; // connect to the gameSession script void Awake() { gameSession = FindObjectOfType <PH_GameSession>(); //must connect to the gameSession script as soon as possible gameSession.SetHeartsDisplay(this); //set itself into the GameSession script }
// Start is called before the first frame update void Start() { ScoreDisplay = GetComponent <TextMeshProUGUI>(); // get the text field attached to the same object gameSession = FindObjectOfType <PH_GameSession>(); // find the game session to use it's data }
// Start is called before the first frame update void Start() { gameSession = FindObjectOfType <PH_GameSession>();//use the game session }