added simple sleep state for elements
refactoring
This commit is contained in:
@@ -61,7 +61,8 @@ public class Level {
|
||||
int Y = Mathf.Clamp(y + j, 0, SizeY-1);
|
||||
object o = Activator.CreateInstance(type, X, Y, _this);
|
||||
|
||||
_elements[X,Y] = o as Element;
|
||||
if (_elements[X,Y].GetType() != type)
|
||||
_elements[X,Y] = o as Element;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,7 +76,7 @@ public class Level {
|
||||
return mImage;
|
||||
}
|
||||
|
||||
public void Swap(Element what, Element swapTo) {
|
||||
private void Swap(Element what, Element swapTo) {
|
||||
Element swap = new Element(what);
|
||||
|
||||
if (what == null || swapTo == null) return;
|
||||
@@ -85,6 +86,11 @@ public class Level {
|
||||
|
||||
swapTo.Position = swap.Position;
|
||||
_elements[swap.Position.X, swap.Position.Y] = swapTo;
|
||||
|
||||
what.Active = true;
|
||||
swapTo.Active = true;
|
||||
what.LastMove = _frame;
|
||||
swapTo.LastMove = _frame;
|
||||
}
|
||||
|
||||
public void Swap(Element what, Vector2I pos) {
|
||||
|
||||
Reference in New Issue
Block a user