This repository has been archived on 2026-04-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2018-04-23 10:12:50 +10:00

30 lines
604 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Lollipop : MonoBehaviour {
Animator animator;
public float timeTillWave = 10;
float timeAccumulated;
void Awake () {
animator = GetComponent<Animator>();
timeAccumulated = Random.Range(0, timeTillWave);
}
void Update () {
timeAccumulated += Time.deltaTime;
if (timeAccumulated >= timeTillWave) {
if (Random.Range(0, 2) == 0) {
animator.SetTrigger("SayHi");
}
timeAccumulated = 0;
}
}
void OnTriggerEnter2D(Collider2D collider) {
//TODO: begin the end screen process
}
}