2020-09-30 13:23:01 +01:00
|
|
|
|
using UnityEngine;
|
2020-10-01 23:35:00 +01:00
|
|
|
|
using UnityEngine.SceneManagement;
|
2020-09-30 13:23:01 +01:00
|
|
|
|
using Pink.Mechanics;
|
|
|
|
|
|
|
|
|
|
namespace Pink.Items
|
|
|
|
|
{
|
|
|
|
|
class FruitController : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public Animator animator;
|
|
|
|
|
|
|
|
|
|
void OnTriggerEnter2D(Collider2D collider)
|
|
|
|
|
{
|
|
|
|
|
var userController = collider.gameObject.GetComponent<PinkController>();
|
|
|
|
|
|
|
|
|
|
if (userController != null)
|
|
|
|
|
{
|
|
|
|
|
animator.SetTrigger("collected");
|
2020-10-01 23:35:00 +01:00
|
|
|
|
Collect();
|
|
|
|
|
SceneManager.LoadScene("second");
|
2020-09-30 13:23:01 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Collect()
|
|
|
|
|
{
|
|
|
|
|
animator.enabled = false;
|
|
|
|
|
GetComponent<CapsuleCollider2D>().enabled = false;
|
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|