private void findFollowTarget() { if (this.following || this.flying) { return; } this.targetAi = null; if (this.controller.spawnedGeese.Count == 0) { return; } this.controller.spawnedGeese.RemoveAll((GameObject o) => o == null); GameObject gameObject = this.controller.spawnedGeese[UnityEngine.Random.Range(0, this.controller.spawnedGeese.Count)]; if (Vector3.Distance(this.tr.position, gameObject.transform.position) < 60f && gameObject.name != base.gameObject.name) { this.targetAi = gameObject.GetComponent <newGooseAi>(); if (this.targetAi.following) { return; } this.following = true; this.targetGo = gameObject; base.StartCoroutine("doFollowTarget", gameObject.transform); base.InvokeRepeating("setFollowSpeed", 1f, 1f); base.Invoke("resetFollow", 30f); } }
private void Start() { this.ai = base.transform.parent.GetComponent <newGooseAi>(); this.rb = base.GetComponentInChildren <Rigidbody>(); this.ragdoll = base.GetComponent <gooseRagdollify>(); }
private void Start() { this.ai = this.ControllerGo.GetComponent <newGooseAi>(); base.Invoke("doStart", 1f); }