Initial commit
This commit is contained in:
1 parent
ee9615239e
commit
16feac691f
4093 files changed
+1030491
No files matched your search
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PigeonController : MonoBehaviour
|
||||
{
|
||||
public Transform player;
|
||||
public float startle_distance;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (player)
|
||||
{
|
||||
float dist = Vector3.Distance(player.position, transform.position);
|
||||
var startled = dist < startle_distance;
|
||||
if (dist < startle_distance)
|
||||
{
|
||||
Debug.LogError($"Startled at {dist}");
|
||||
}
|
||||
|
||||
foreach (var childAnim in GetComponentsInChildren<Animator>())
|
||||
{
|
||||
childAnim.SetBool("Startled", startled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user