Commit f352e138 authored by 18손재민's avatar 18손재민

Merge branch 'LifeStone' into tetris

parents 15f33ee6 5cb82644
......@@ -13,3 +13,10 @@ public enum AddonType
Component,
Theory
}
public enum LifeStoneType
{
Normal=1,
Gold=2,
Amethyst=3
}
......@@ -68,6 +68,8 @@ public class LifeStoneManager : MonoBehaviour {
IEnumerator TestEnumerator()
{
yield return null;
PushLifeStone(new LifeStoneInfo(new Vector2Int(3, 8), "AAAAAAAAAAAAAAAAAAAAAAAA"));
/*
PushLifeStone(new LifeStoneInfo(new Vector2Int(3, 1), "AAA"));
yield return new WaitForSeconds(2);
PushLifeStone(new LifeStoneInfo(new Vector2Int(3, 2), "AAAA A"));
......@@ -320,12 +322,12 @@ public class LifeStoneManager : MonoBehaviour {
public int CountType(int type)
public int CountType(LifeStoneType type)
{
int count = 0;
for (int j = 0; j < 3; j++)
for (int i = 0; i < lifeStoneRowNum; i++)
if (lifeStoneArray[j, i] == type)
if (lifeStoneArray[j, i] == (int)type)
count++;
return count;
}
......@@ -369,7 +371,7 @@ public class LifeStoneManager : MonoBehaviour {
}
}
public void ChangeFromNormal(int type, int num)
public void ChangeFromNormal(LifeStoneType type, int num)
{
System.Random rnd = new System.Random();
ArrayList candArray = new ArrayList();
......@@ -382,18 +384,18 @@ public class LifeStoneManager : MonoBehaviour {
for(int i=0; i<candArray.Count; i++)
{
Vector2Int vtmp = (Vector2Int)candArray[i];
lifeStoneArray[vtmp.y, vtmp.x] = type;
lifeStoneArray[vtmp.y, vtmp.x] = (int)type;
}
StartCoroutine(ChangeInPhase(candArray,type));
StartCoroutine(ChangeInPhase(candArray,(int)type));
}
public void ChangeToNormal(int type, int num)
public void ChangeToNormal(LifeStoneType type, int num)
{
System.Random rnd = new System.Random();
ArrayList candArray = new ArrayList();
for (int j = 0; j < lifeStoneRowNum; j++)
for (int i = 0; i < 3; i++)
if (lifeStoneArray[j, i] == type)
if (lifeStoneArray[j, i] == (int)type)
candArray.Add(new Vector2Int(i, j));
while (candArray.Count > num)
candArray.RemoveAt(rnd.Next(candArray.Count));
......
......@@ -23,14 +23,14 @@ public class LifeStoneTest : MonoBehaviour {
public void gold()
{
int tmp = Convert.ToInt32(goldText.GetComponent<InputField>().text);
if (tmp > 0) uii.ChangeFromNormal(2, tmp);
else if (tmp < 0) uii.ChangeToNormal(2, -tmp);
if (tmp > 0) uii.ChangeFromNormal(LifeStoneType.Gold, tmp);
else if (tmp < 0) uii.ChangeToNormal(LifeStoneType.Gold, -tmp);
}
public void amethyst()
{
int tmp = Convert.ToInt32(amethystText.GetComponent<InputField>().text);
if (tmp > 0) uii.ChangeFromNormal(3, tmp);
else if (tmp < 0) uii.ChangeToNormal(3, -tmp);
if (tmp > 0) uii.ChangeFromNormal(LifeStoneType.Amethyst, tmp);
else if (tmp < 0) uii.ChangeToNormal(LifeStoneType.Amethyst, -tmp);
}
public void dest()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment