Newer
Older
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Forest : Resource
{
private bool isForester;
private float growthspeed;
public void setForester(bool i)
{
isForester = i;
if (isForester == true)
{
growthspeed = 0.5f;
}
else
{
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
if (resources < 125)
{
//yhden puun sprite
}
else if (resources < 250)
{
//2 sprite
}
else if (resources < 375)
{
}
else if (resources < 500)
{
}
else if (resources < 625)
{
}
else if (resources < 750)
{
}
else if (resources < 875)
{
}
else
{
}
}
public override void checkExistence()
{
if (resources < 1)
{
Destroy(gameObject);
}
}
// Start is called before the first frame update
void Start()
{
resources = Random.Range(50, 300);
isForester = false;
growthspeed = 1;
}
// Update is called once per frame
void Update()
{
}
IEnumerator Grow()
{
while (resources < 1000)
{
resources++;