48 lines
701 B
C#
48 lines
701 B
C#
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;
|
|
}
|
|
}
|