TO SQUASH: Jesus!!
This commit is contained in:
@@ -39,7 +39,9 @@ public abstract class YummyBase : MonoBehaviour
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Force reset the rotation.
|
||||
transform.rotation = Quaternion.identity;
|
||||
transform.Translate(speed);
|
||||
|
||||
missedTimer += Time.fixedDeltaTime;
|
||||
@@ -62,17 +64,8 @@ public abstract class YummyBase : MonoBehaviour
|
||||
|
||||
if(other.gameObject.CompareTag("Bar"))
|
||||
{
|
||||
audioSource.PlayOneShot(obtainedSound);
|
||||
|
||||
var player = GameObject.FindGameObjectWithTag("Player");
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
ObtainedCallback(player.GetComponent<Player>());
|
||||
}
|
||||
|
||||
isObtained = true;
|
||||
spriteRenderer.enabled = false;
|
||||
Obtain(player.GetComponent<Player>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,5 +89,28 @@ public abstract class YummyBase : MonoBehaviour
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
public void AwardToPlayer(Player player)
|
||||
{
|
||||
Obtain(player);
|
||||
}
|
||||
|
||||
private void Obtain(Player player)
|
||||
{
|
||||
if (isObtained || isMissed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
audioSource.PlayOneShot(obtainedSound);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
ObtainedCallback(player);
|
||||
}
|
||||
|
||||
isObtained = true;
|
||||
spriteRenderer.enabled = false;
|
||||
}
|
||||
|
||||
protected abstract void ObtainedCallback(Player player);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user