Falling Apart - Destroybycontact Script
Falling Apart - Destroybycontact Script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
void Start()
{
GameObject gameControllerObject = GameObject.FindWithTag("GameController");
if (gameControllerObject != null)
{
gameController = gameControllerObject.GetComponent<GameController>();
}
if (gameController == null)
{
Debug.Log("Cannot find 'GameController' script");
}
animator = GetComponent<Animator>();
}
void Update()
{
//Establishes the lives system
switch (lives)
{
//Displays 3 Lives
case 3:
star1.gameObject.SetActive(true);
star2.gameObject.SetActive(true);
star3.gameObject.SetActive(true);
break;
//Displays 2 Lives
case 2:
star1.gameObject.SetActive(true);
star2.gameObject.SetActive(true);
star3.gameObject.SetActive(false);
break;
//Display 1 Life
case 1:
star1.gameObject.SetActive(true);
star2.gameObject.SetActive(false);
star3.gameObject.SetActive(false);
break;