コード例 #1
0
 // Start is called before the first frame update
 void Start()
 {
     thisSource         = this.GetComponent <AudioSource>();
     thisAI             = this.GetComponent <Deer_AI>();
     EnviromentalSource = GameObject.Find("EnviromentalSound").GetComponent <AudioSource>();
     startVol           = EnviromentalSource.volume;
 }
コード例 #2
0
    private void OnTriggerEnter(Collider other)
    {
        Debug.Log(other.gameObject.name);
        if (other.gameObject.tag == "Stag")
        {
            DeerAI = other.gameObject.GetComponent <Deer_AI>();

            if (!DeerAI.alreadylooking)
            {
                DeerAI.alreadylooking = true;
                DeerAI.currentState   = Deer_AI.AIStates.Alert;
                DeerAI.DeerMaxVision  = 20f;
                DeerAI.actionTimer    = Random.Range(5, 10);
                DeerAI.switchActions  = false;
                DeerAI.SwitchAnimationState(Deer_AI.AIStates.Alert);
            }
        }
    }
コード例 #3
0
 void Awake()
 {
     DeerAI = Deer.GetComponent <Deer_AI>();
 }