示例#1
0
        protected override void Awake()
        {
            base.Awake();
            if (gameplayCameraPrefab != null)
            {
                CacheGameplayCameraControls = Instantiate(gameplayCameraPrefab);
            }
            if (minimapCameraPrefab != null)
            {
                CacheMinimapCameraControls = Instantiate(minimapCameraPrefab);
            }
            // This entity detector will be find entities to use when pressed activate key
            GameObject tempGameObject = new GameObject("_ActivatingEntityDetector");

            ActivatableEntityDetector = tempGameObject.AddComponent <NearbyEntityDetector>();
            ActivatableEntityDetector.detectingRadius      = CurrentGameInstance.conversationDistance;
            ActivatableEntityDetector.findPlayer           = true;
            ActivatableEntityDetector.findOnlyAlivePlayers = true;
            ActivatableEntityDetector.findNpc                      = true;
            ActivatableEntityDetector.findBuilding                 = true;
            ActivatableEntityDetector.findOnlyAliveBuildings       = true;
            ActivatableEntityDetector.findOnlyActivatableBuildings = true;
            ActivatableEntityDetector.findVehicle                  = true;
            // This entity detector will be find item drop entities to use when pressed pickup key
            tempGameObject         = new GameObject("_ItemDropEntityDetector");
            ItemDropEntityDetector = tempGameObject.AddComponent <NearbyEntityDetector>();
            ItemDropEntityDetector.detectingRadius = CurrentGameInstance.pickUpItemDistance;
            ItemDropEntityDetector.findItemDrop    = true;
        }
示例#2
0
        protected override void Awake()
        {
            base.Awake();
            buildingItemIndex     = -1;
            findingEnemyIndex     = -1;
            isLeftHandAttacking   = false;
            CurrentBuildingEntity = null;

            if (targetObjectPrefab != null)
            {
                // Set parent transform to root for the best performance
                CacheTargetObject = Instantiate(targetObjectPrefab);
                CacheTargetObject.SetActive(false);
            }
            // This entity detector will be find entities to use when pressed activate key
            GameObject tempGameObject = new GameObject("_ActivatingEntityDetector");

            activatingEntityDetector = tempGameObject.AddComponent <NearbyEntityDetector>();
            activatingEntityDetector.detectingRadius      = gameInstance.conversationDistance;
            activatingEntityDetector.findPlayer           = true;
            activatingEntityDetector.findOnlyAlivePlayers = true;
            activatingEntityDetector.findNpc                      = true;
            activatingEntityDetector.findBuilding                 = true;
            activatingEntityDetector.findOnlyAliveBuildings       = true;
            activatingEntityDetector.findOnlyActivatableBuildings = true;
            // This entity detector will be find item drop entities to use when pressed pickup key
            tempGameObject         = new GameObject("_ItemDropEntityDetector");
            itemDropEntityDetector = tempGameObject.AddComponent <NearbyEntityDetector>();
            itemDropEntityDetector.detectingRadius = gameInstance.pickUpItemDistance;
            itemDropEntityDetector.findItemDrop    = true;
            // This entity detector will be find item drop entities to use when pressed pickup key
            tempGameObject                            = new GameObject("_EnemyEntityDetector");
            enemyEntityDetector                       = tempGameObject.AddComponent <NearbyEntityDetector>();
            enemyEntityDetector.findPlayer            = true;
            enemyEntityDetector.findOnlyAlivePlayers  = true;
            enemyEntityDetector.findPlayerToAttack    = true;
            enemyEntityDetector.findMonster           = true;
            enemyEntityDetector.findOnlyAliveMonsters = true;
            enemyEntityDetector.findMonsterToAttack   = true;
        }