Beispiel #1
0
        public void Act()
        {
            PickableControllerWeapon targetWeapon = TargetMethod.TargetWeapon(pickableSensor);
            EnnemyController         targetEnemy  = TargetMethod.TargetEnemy(enemySensor);

            if (targetWeapon != null)
            {
                mover.MoveToward(targetWeapon.transform.position);
                if (targetEnemy != null)
                {
                    handController.SetRotationHand((Vector2)targetEnemy.transform.position);
                    handController.Use();
                }
                else
                {
                    handController.SetRotationHand((Vector2)targetWeapon.transform.position);
                }
            }
            else
            {
                if (targetEnemy != null)
                {
                    mover.Follow(targetEnemy.transform.position, distanceFollow);
                    handController.Use();
                }
                else
                {
                    TargetMethod.SearchEnemyOrPickable(mover, ref randomSearch);
                    handController.SetRotationHand((Vector2)randomSearch);
                }
            }
        }
Beispiel #2
0
        public void Act()
        {
            EnnemyController target = TargetMethod.TargetEnemyNotZombie(enemySensor);

            if (target != null)
            {
                mover.MoveToward(target.transform.position);
            }
            else
            {
                TargetMethod.SearchEnemyOrPickable(mover, ref randomSearch);
            }
        }
Beispiel #3
0
        public void Act()
        {
            EnnemyController target = TargetMethod.TargetEnemy(enemySensor);

            if (target != null)
            {
                mover.Follow(target.transform.position, distanceFollow);
                handController.Use();
            }
            else
            {
                TargetMethod.SearchEnemyOrPickable(mover, ref randomSearch);
            }
        }
Beispiel #4
0
        public void Act()
        {
            ConfigureDistance();
            if (health.HealthPoints < HEALTH_LIMIT_TO_BE_COWBOY)
            {
                if (health.HealthPoints < HEALTH_LIMIT_TO_SEARCH_MEDKIT)
                {
                    PickableControllerMedKit medkit = TargetMethod.TargetMedkit(pickableSensor);

                    if (medkit != null)
                    {
                        mover.MoveToward(medkit.transform.position);
                    }
                    else
                    {
                        TargetMethod.SearchEnemyOrPickable(mover, ref randomSearch);
                    }
                }
                else
                {
                    PickableControllerWeapon weapon = TargetMethod.TargetWeapon(pickableSensor);
                    if (weapon != null)
                    {
                        mover.MoveToward(weapon.transform.position);
                    }
                    else
                    {
                        EnnemyController enemy = TargetMethod.TargetEnemy(enemySensor);
                        if (enemy != null)
                        {
                            mover.KeepDistance(enemy.transform.position, safeDistance);
                            handController.Use();
                        }
                        else
                        {
                            TargetMethod.SearchEnemyOrPickable(mover, ref randomSearch);
                        }
                    }
                }
            }
            else
            {
                cowboy.Act();
            }
        }
Beispiel #5
0
        public void Act()
        {
            PickableControllerMedKit medkit = TargetMethod.TargetMedkit(pickableSensor);

            if (pickableMedkit == null && medkit != null)
            {
                pickableMedkit           = medkit;
                pickableMedkit.OnPickUp += OnPickUp;
            }

            if (Time.time - timeAtBeginning > SECONDS_TO_PICK_MEDKIT)
            {
                if (pickableMedkit != null)
                {
                    if (Vector2.Distance(pickableMedkit.transform.position, mover.transform.position) < MEDKIT_DISTANCE)
                    {
                        if (health.HealthPoints > 30)
                        {
                            EnnemyController targetEnemy = TargetMethod.TargetEnemy(enemySensor);
                            if (targetEnemy == null)
                            {
                                mover.Rotate(-1);
                            }
                            else
                            {
                                mover.SetRotationToLookAt(targetEnemy.transform.position);
                                handController.Use();
                            }
                        }
                        else
                        {
                            mover.MoveToward(pickableMedkit.transform.position);
                        }
                    }
                    else
                    {
                        mover.MoveToward(pickableMedkit.transform.position);
                    }
                }
                else
                {
                    PickableControllerWeapon pickableWeapon = TargetMethod.TargetWeapon(pickableSensor);
                    if (pickableWeapon != null)
                    {
                        mover.MoveToward(pickableWeapon.transform.position);
                    }
                    else
                    {
                        TargetMethod.SearchEnemyOrPickable(mover, ref randomSearch);
                    }
                }
            }
            else
            {
                if (pickableMedkit != null)
                {
                    mover.MoveToward(pickableMedkit.transform.position);
                }
                else
                {
                    TargetMethod.SearchEnemyOrPickable(mover, ref randomSearch);
                }
            }
        }