public void Enter() { levelSndInstance = levelSnd.CreateInstance(); //levelSndInstance.Play(); rectangles = state.levelManager.levels[2].rectangles; //gate gateRectangle = new RectangleObjects(336, 24, 96, 72); rectangles.Add(gateRectangle); //reset resetRectangle = new Rectangle(336, 662, 98, 10); collide = new Collision(rectangles, actors, state); grabThrow = new GrabThrow(actors); patrol = new Patroling(rectangles, actors, resetRectangle); rockHit = new RockHit(actors, grabThrow); checkWin = new CheckWin(actors); pursue = new Pursue(actors, state); }
void Start() { orange = GameObject.Find("orange").GetComponent <PatrolHoler>(); patroling = GetComponent <Patroling>(); orange.AddPatrol(this); }
// Start is called before the first frame update void Start() { fov = GetComponent <FieldOfView>(); patroling = GetComponent <Patroling>(); gun = GetComponentsInChildren <Gun>()[0]; }
void Start() { patrol = GetComponent <CustomParenting>().parent.GetComponent <Patroling>(); }
public void EnemyControllerUpdate(float deltaTime) { if (alive) { if (conditions.HasActiveConditions) { CheckHealth.Invoke(); conditions.ConditionsUpdateStart(CharacterModel, ref spec, deltaTime); } ///<summary> ///Проверка состояния деятельности врага /// </summary> if (inChase) { enemyView.enabled = false; Chasing.Chase(player, deltaTime); //Debug.Log("Chasing"); } else if (comingHome) { //Debug.Log("ComingHome"); timer += deltaTime; ComingHome.ComingHome(); if (timer > 3f && !enemyView.enabled) { enemyView.enabled = true; } } else if (onPatrol) { Patroling.Patrol(route); } else if (onIdle) { Idle.Idle(); } else if (inFight) { Fight.Fight(player, deltaTime); } else { var choseAct = Random.Range(-patrolChance, idleChance); if (choseAct < 0) { onPatrol = true; route = RouteGenerator.Compile(homePoint, spec.PatrolDistance); patrolChance--; idleChance = 5; } else { onIdle = true; idleChance--; patrolChance = 5; } } } else { Move.Stop(); headMesh.enabled = false; gun.enabled = false; knife.enabled = false; enemyBorder.enabled = false; //выключаем коллайдер rb.constraints = RigidbodyConstraints.FreezeAll; //замораживаем перемещения и повороты Dying.Die(mesh, deltaTime); //запускаем событие смерти } }