Update ItemStash & EnemyReturn Script Conform OOP

This commit is contained in:
Philip W 2021-11-02 16:36:10 +00:00
parent 1d0a89a9ef
commit eaac888ac1
2 changed files with 6 additions and 2 deletions

View File

@ -13,7 +13,7 @@ public class ItemStash : MonoBehaviour
if (objectTag == "Enemy" && droppedItemAmount > 0)
{
droppedItemAmount -= 1;
other.gameObject.GetComponent<EnemyReturn>().hasDroppableObject = true;
other.gameObject.GetComponent<EnemyReturn>().toggleHasDroppableObject();
}
}

View File

@ -15,8 +15,8 @@ public class EnemyReturn : Physics2DObject
[Header("Death Effect When Shot")]
public GameObject deathEffect;
[Header("Has Droppable Object")]
public bool hasDroppableObject = false;
private bool hasDroppableObject = false;
private bool isReturning = false;
private Vector2 movement = new Vector2(0f, 0f);
@ -74,4 +74,8 @@ public class EnemyReturn : Physics2DObject
Destroy(gameObject);
}
}
public void toggleHasDroppableObject()
{
hasDroppableObject = (hasDroppableObject) ? false : true;
}
}