// Start is called before the first frame update void Start() { IsAlive = true; FishName = NewName(); if (rigidBody == null) { rigidBody = this.GetComponent <Rigidbody>(); } if (tankBoundary == null) { tankBoundary = GetComponent <TankBoundary>(); } if (tankBoundary == null) { tankBoundary = GetComponentInParent <TankBoundary>(); } if (target == null) { target = this.transform.Find("Target")?.gameObject; } if (target == null) { target = this.gameObject; } if (colliders == null) { colliders = this.GetComponentsInChildren <Collider>().Where(c => c.enabled).ToArray(); } if (fishManager == null) { fishManager = FindObjectOfType <FishManager>(); } if (fishManager != null) { fishManager.fish.Add(this); } if (feeder == null) { feeder = FindObjectOfType <FoodFeeder>(); } if (position != null) { this.transform.position = position.Position; this.transform.rotation = position.Rotation; } }
// Start is called before the first frame update void Start() { if (foodParent == null) { foodParent = this.gameObject; } if (feedLocation == null) { feedLocation = this.GetComponent <TankBoundary>(); } }