void Start() { //attack = true; //transformCache = gameObject.transform; //lineRenderer = GetComponent<LineRenderer>(); //rigidbody2DCache = GetComponent<Rigidbody2D>(); //seeker = GetComponent<Seeker>(); //id = GlobalID.GetID(); //Надо будет сделать статичным motorNow = new MotorNow(transformCache, rigidbody2DCache, speed, speedRotate, target.transform, seeker); visibleTypical = new VisibleTypical(transformCache, lineRenderer, target, layerMask, angle, distance, tagMask); findAngry = new FindAngry(transformCache, motorNow, visibleTypical, distanceFind); movedRandom = new MovedRandom(transformCache, new Vector3[4], motorNow, minDelay, maxDelay, point, distancePoint); //movedFollowingObj = new MovedFollowingObj(transformCache, motorNow, distanceFollowing, distanceTeleport); player = target.GetComponent <IPlayer>(); }
void Start() { _transformList = new[] { onePoint.transform, twoPoint.transform, threePoint.transform, foPoint.transform, onePoint.transform, }; _lineRender = gameObject.AddComponent <LineRenderer>(); _lineRender = gameObject.GetComponent <LineRenderer>(); if (Application.IsPlaying(gameObject)) { _transform = transform; for (var a = 0; a < count; a++) { GameObject mob = Instantiate(mobs, _transform.position, _transform.rotation); MovedRandom randomComponent = mob.GetComponent <MovedRandom>(); if (randomComponent != null) { // randomComponent.onePoint = onePoint; // randomComponent.twoPoint = twoPoint; // randomComponent.threePoint = threePoint; // randomComponent.foPoint = foPoint; } else { Debug.Log("Ошибка. У моба должен быть компонент MovedRandom"); return; } } } }