//Start overrides the Start function of MovingObject protected override void Start() { if (componentProvider == null) { //Get a component reference to the Player's animator component componentProvider = this; } if (gameManagerService == null) { gameManagerService = GameManager.instance; } rigidBody = new RigidBodyWrapper(this); attackTracker = false; animator = componentProvider.GetComponent <Animator> (); //Get the current food point total stored in GameManager.instance between levels. health = gameManagerService.playerFoodPoints; if (foodText != null) { //Set the foodText to reflect the current player food total. foodText.text = "Health: " + health; } if (GameManager.instance != null) { //checks if player has a key from the GameManager between levels hasKey = GameManager.instance.playerHasKey; //gets the starting time of the game dt = GameManager.instance.startingTime; } isChestOpen = false; //sets the timeText to reflect the currents time //timeText.text = "ASDASDASDSAD"; //for testing purposes lastAttackTime = -5; //Call the Start function of the MovingObject base class. base.Start(); }
public void setGameManagerService(IGameManager service) { gameManagerService = service; }