// Use this for initialization void Awake() { _towerPlacement = GameObject.Find("GameController").transform.GetComponent <TowerPlacement>(); foreach (Collider c in GetComponentsInChildren <Collider>()) { _colliders.Add(c); } foreach (Renderer r in GetComponentsInChildren <Renderer>()) { _renderers.Add(r); } obstacle = GetComponent <NavMeshObstacle>(); obstacle.size = new Vector3(1.5f, 2, 1.5f); }
// Use this for initialization void Start() { _slimeAudio = GetComponent <SlimeAudio>(); _maxHitpoints = _hitpoints; if (_type == SlimeType.Gas) { _transformEffects = this.GetComponents <GasSlimeTransformScript>(); } _towerplacement = GameObject.FindObjectOfType <TowerPlacement>();//("GameController").transform.GetComponent<TowerPlacement>(); _finalDestination = FindObjectOfType <Game>()._finalDestination; _player = GameObject.Find("Main_Character"); _playerdummy = _player.GetComponent <Player>(); if (_type != SlimeType.Gas) { _navMeshAgent = GetComponent <NavMeshAgent>(); _navMeshAgent.stoppingDistance = 1; SetTargetLocation(); } foreach (var rend in GetComponentsInChildren <Renderer>()) { _standardColor.Add(rend.material.color); } }