Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 void Start()
 {
     orange    = GameObject.Find("orange").GetComponent <PatrolHoler>();
     patroling = GetComponent <Patroling>();
     orange.AddPatrol(this);
 }
Esempio n. 3
0
 // Start is called before the first frame update
 void Start()
 {
     fov       = GetComponent <FieldOfView>();
     patroling = GetComponent <Patroling>();
     gun       = GetComponentsInChildren <Gun>()[0];
 }
Esempio n. 4
0
 void Start()
 {
     patrol = GetComponent <CustomParenting>().parent.GetComponent <Patroling>();
 }
Esempio n. 5
0
        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);                           //запускаем событие смерти
            }
        }