Basic functionality

This commit is contained in:
James Hodgson
2022-04-13 01:41:08 +01:00
parent cde9a606dc
commit 2efbbfa61a
9 changed files with 814 additions and 1 deletions

View File

@@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Collectible : MonoBehaviour
{
public int score = 1;
public bool collected = false;
public bool isEnabled = true;
Renderer r;
// Start is called before the first frame update
void Start()
{
r = GetComponent<Renderer>();
if (collected || !isEnabled)
{
Hide();
}
}
// Update is called once per frame
void Update()
{
}
public void Collect()
{
collected = true;
Hide();
}
void Hide()
{
r.enabled = false;
}
void Show()
{
r.enabled = true;
}
}