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
monsterstalker/Assets/Scripts/Monster.cs
T
2018-04-10 23:53:49 +10:00

25 lines
480 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Monster : MonoBehaviour {
public int value;
void Awake() {
StartCoroutine (DestroySelfAfter (30f));
}
void OnMouseOver() {
if (Input.GetMouseButtonDown(0)) {
//TODO: play death sound
PersistentData.score += value;
Destroy (gameObject);
}
}
IEnumerator DestroySelfAfter(float seconds) {
yield return new WaitForSeconds (seconds);
Destroy (gameObject);
}
}