// Use this for initialization void Start() { audioManager = FindObjectOfType <AudioManager>(); checkPointSystem = GameObject.FindGameObjectWithTag("CheckPointSystem").GetComponent <CheckPointSystem>(); animator = GetComponent <Animator>(); akuAku = GameObject.FindGameObjectWithTag("AkuAku").GetComponent <AkuAku>(); lifeDisplayer = lifeCanvas.GetComponent <Displayer>(); wumpaDisplayer = wumpaCanvas.GetComponent <Displayer>(); spawnPoint = transform.position; //get the position spawn if (checkPointSystem.checkpointsUnlocked.Count > 0) { lifeDisplayer.DisplayInfo(checkPointSystem.lifeAmount); Vector3 position = checkPointSystem.checkpointsUnlocked.Last(); position.y += 0.35F; transform.position = position; } else { transform.position = spawnPoint; TeleportStart(); } }
public void EatWumpaFruit() { checkPointSystem.wumpaFruitAmount++; wumpaDisplayer.DisplayInfo(checkPointSystem.wumpaFruitAmount); if (checkPointSystem.wumpaFruitAmount >= 100) { addLife(); checkPointSystem.wumpaFruitAmount = 0; } }
public void addLife() { checkPointSystem.lifeAmount++; audioManager.Play("life"); lifeDisplayer.DisplayInfo(checkPointSystem.lifeAmount); }