Skip to content
Snippets Groups Projects
Quarry.cs 1.33 KiB
Newer Older
Erno Lokkila's avatar
Erno Lokkila committed
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

Leevi Grönlund's avatar
Leevi Grönlund committed
public class Quarry : Resource
Erno Lokkila's avatar
Erno Lokkila committed
{
Leevi Grönlund's avatar
Leevi Grönlund committed
 
    public override void checkExistence()
    {
        if (getAmount() < 1)
Leevi Grönlund's avatar
Leevi Grönlund committed
        {
            gameObject.SetActive(false);
Leevi Grönlund's avatar
Leevi Grönlund committed
        }
    }

    public override void refreshSprite()
    {
        if (sprites == null) return;
Leevi Grönlund's avatar
Leevi Grönlund committed
        if (getAmount() < 50)
        {
            gameObject.GetComponent<SpriteRenderer>().sprite = sprites[5];
        }
Leevi Grönlund's avatar
Leevi Grönlund committed
        else if (getAmount() < 166)
        {
            gameObject.GetComponent<SpriteRenderer>().sprite = sprites[4];
        }
Leevi Grönlund's avatar
Leevi Grönlund committed
        else if (getAmount() < 333)
        {
            gameObject.GetComponent<SpriteRenderer>().sprite = sprites[3];
        }
Leevi Grönlund's avatar
Leevi Grönlund committed
        else if (getAmount() < 500)
        {
            gameObject.GetComponent<SpriteRenderer>().sprite = sprites[2];
        }
Leevi Grönlund's avatar
Leevi Grönlund committed
        else if (getAmount() < 633)
        {
            gameObject.GetComponent<SpriteRenderer>().sprite = sprites[1];
        }
        else
        {
            gameObject.GetComponent<SpriteRenderer>().sprite = sprites[0];
        }
Erno Lokkila's avatar
Erno Lokkila committed
    // Start is called before the first frame update
    void Start()
    {
Leevi Grönlund's avatar
Leevi Grönlund committed
        setEventType(EventType.StoneCut);
Leevi Grönlund's avatar
Leevi Grönlund committed
        setAmount(Random.Range(500, 800));
Erno Lokkila's avatar
Erno Lokkila committed
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}