Синтаксис:
Используется csharp
using UnityEngine;
public class BarrierAnimation : MonoBehaviour
{
public GameObject ObjectWithAnim;
public void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
ObjectWithAnim.GetComponent<Animation>().Play();
}
}
public void OnTriggerExit(Collider other)
{
if (other.gameObject.tag == "Player")
{
ObjectWithAnim.GetComponent<Animation>().Play("Down");
}
}
}
public class BarrierAnimation : MonoBehaviour
{
public GameObject ObjectWithAnim;
public void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
ObjectWithAnim.GetComponent<Animation>().Play();
}
}
public void OnTriggerExit(Collider other)
{
if (other.gameObject.tag == "Player")
{
ObjectWithAnim.GetComponent<Animation>().Play("Down");
}
}
}