Update ItemStash & EnemyReturn Script Conform OOP
This commit is contained in:
parent
1d0a89a9ef
commit
eaac888ac1
@ -13,7 +13,7 @@ public class ItemStash : MonoBehaviour
|
|||||||
if (objectTag == "Enemy" && droppedItemAmount > 0)
|
if (objectTag == "Enemy" && droppedItemAmount > 0)
|
||||||
{
|
{
|
||||||
droppedItemAmount -= 1;
|
droppedItemAmount -= 1;
|
||||||
other.gameObject.GetComponent<EnemyReturn>().hasDroppableObject = true;
|
other.gameObject.GetComponent<EnemyReturn>().toggleHasDroppableObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ public class EnemyReturn : Physics2DObject
|
|||||||
[Header("Death Effect When Shot")]
|
[Header("Death Effect When Shot")]
|
||||||
public GameObject deathEffect;
|
public GameObject deathEffect;
|
||||||
[Header("Has Droppable Object")]
|
[Header("Has Droppable Object")]
|
||||||
public bool hasDroppableObject = false;
|
|
||||||
|
|
||||||
|
private bool hasDroppableObject = false;
|
||||||
private bool isReturning = false;
|
private bool isReturning = false;
|
||||||
private Vector2 movement = new Vector2(0f, 0f);
|
private Vector2 movement = new Vector2(0f, 0f);
|
||||||
|
|
||||||
@ -74,4 +74,8 @@ public class EnemyReturn : Physics2DObject
|
|||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void toggleHasDroppableObject()
|
||||||
|
{
|
||||||
|
hasDroppableObject = (hasDroppableObject) ? false : true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user