Пример #1
0
        async public Task PerformMovement(int nextNodeID)
        {
            Vector3 nextLocation = pathService.GetNodeLocation(nextNodeID);

            if (pathService.CheckIfTeleportable(playerNodeID, nextNodeID))
            {
                pathService.HighlightTeleportNodes(nextNodeID);
            }
            //else {
            //    pathService.UnhighlightTeleportableNodes();
            //}

            await MoveToLocation(nextLocation);

            playerNodeID = nextNodeID;


            if (interactableService.CheckForInteractable(nextNodeID))
            {
                IInteractableController interactableController = interactableService.ReturnInteractableController(nextNodeID);
                PerformInteractableAction(interactableController);
            }
            if (IsGameFinished())
            {
                playerService.FireLevelFinishedSignal();
            }
            else if (GetPlayerState() != PlayerStates.WAIT_FOR_INPUT)
            {
                gameService.ChangeToEnemyState();
            }
        }
Пример #2
0
 void SetGates(List <GateData> gates)
 {
     for (int i = 0; i < gates.Count; i++)
     {
         GateControllerView gate = GameObject.Instantiate(gates[i].gatePrefab, gates[i].position, Quaternion.identity).GetComponent <GateControllerView>();
         physicalGates.Add(gate);
         gate.gameObject.transform.LookAt(new Vector3(pathService.GetNodeLocation(gates[i].node1).x, gate.gameObject.transform.position.y, pathService.GetNodeLocation(gates[i].node1).z));
         gate.SetGate(gates[i].key, gates[i].node1, gates[i].node2);
     }
 }
Пример #3
0
        public PlayerController(IPlayerService _playerService, IGameService _gameService, IPathService _pathService, IInteractable _interactableService, PlayerScriptableObject _playerScriptableObject, SignalBus signalBus)
        {
            this.signalBus      = signalBus;
            playerService       = _playerService;
            pathService         = _pathService;
            gameService         = _gameService;
            interactableService = _interactableService;

            scriptableObject = _playerScriptableObject;

            playerNodeID  = pathService.GetPlayerNodeID();
            spawnLocation = pathService.GetNodeLocation(playerNodeID);

            SpawnPlayerView();
            playerService.GetSignalBus().Subscribe <DisguiseSignal>(SetDisguiseType);
        }
Пример #4
0
        private List <IEnemyController> SpawnSingleEnemyLocations(EnemyScriptableObject _enemyScriptableObject)
        {
            List <EnemySpawnData>   spawnNodeID         = new List <EnemySpawnData>();
            List <IEnemyController> newEnemyControllers = new List <IEnemyController>();

            spawnNodeID.Clear();
            spawnNodeID = pathService.GetEnemySpawnLocation(_enemyScriptableObject.enemyType);

            switch (_enemyScriptableObject.enemyType)
            {
            case EnemyType.STATIC:
                for (int i = 0; i < spawnNodeID.Count; i++)
                {
                    Vector3 spawnLocation = pathService.GetNodeLocation(spawnNodeID[i].node);

                    IEnemyController newEnemy = new StaticEnemyController(enemyService, pathService, gameService, spawnLocation, _enemyScriptableObject, spawnNodeID[i].node, spawnNodeID[i].dir, spawnNodeID[i].hasShield);
                    newEnemyControllers.Add(newEnemy);
                }
                break;

            case EnemyType.PATROLLING:

                for (int i = 0; i < spawnNodeID.Count; i++)
                {
                    Vector3          spawnLocation = pathService.GetNodeLocation(spawnNodeID[i].node);
                    IEnemyController newEnemy      = new PatrollingEnemyController(enemyService, pathService, gameService, spawnLocation, _enemyScriptableObject, spawnNodeID[i].node, spawnNodeID[i].dir, spawnNodeID[i].hasShield);
                    newEnemyControllers.Add(newEnemy);
                }
                break;

            case EnemyType.ROTATING_KNIFE:
                for (int i = 0; i < spawnNodeID.Count; i++)
                {
                    Vector3          spawnLocation = pathService.GetNodeLocation(spawnNodeID[i].node);
                    IEnemyController newEnemy      = new RotatingKnifeEnemyController(enemyService, pathService, gameService, spawnLocation, _enemyScriptableObject, spawnNodeID[i].node, spawnNodeID[i].dir, spawnNodeID[i].hasShield);
                    newEnemyControllers.Add(newEnemy);
                }
                break;

            case EnemyType.CIRCULAR_COP:

                for (int i = 0; i < spawnNodeID.Count; i++)
                {
                    Vector3          spawnLocation = pathService.GetNodeLocation(spawnNodeID[i].node);
                    IEnemyController newEnemy      = new CircularCopEnemyController(enemyService, pathService, gameService, spawnLocation, _enemyScriptableObject, spawnNodeID[i].node, spawnNodeID[i].dir, spawnNodeID[i].hasShield);
                    newEnemy.SetCircularCopID(cID);
                    newEnemyControllers.Add(newEnemy);
                    cID++;
                }

                break;

            case EnemyType.DOGS:
                for (int i = 0; i < spawnNodeID.Count; i++)
                {
                    Vector3          spawnLocation = pathService.GetNodeLocation(spawnNodeID[i].node);
                    IEnemyController newEnemy      = new DogsEnemyController(enemyService, pathService, gameService, signalBus, spawnLocation, _enemyScriptableObject, spawnNodeID[i].node, spawnNodeID[i].dir, spawnNodeID[i].hasShield);
                    newEnemyControllers.Add(newEnemy);
                }
                break;

            case EnemyType.SNIPER:
                for (int i = 0; i < spawnNodeID.Count; i++)
                {
                    Vector3          spawnLocation = pathService.GetNodeLocation(spawnNodeID[i].node);
                    IEnemyController newEnemy      = new SniperEnemyController(enemyService, pathService, gameService, spawnLocation, _enemyScriptableObject, spawnNodeID[i].node, spawnNodeID[i].dir, spawnNodeID[i].hasShield);
                    newEnemyControllers.Add(newEnemy);
                }
                break;

            case EnemyType.TARGET:
                for (int i = 0; i < spawnNodeID.Count; i++)
                {
                    Vector3          spawnLocation = pathService.GetNodeLocation(spawnNodeID[i].node);
                    IEnemyController newEnemy      = new TargetEnemyController(enemyService, pathService, gameService, spawnLocation, _enemyScriptableObject, spawnNodeID[i].node, spawnNodeID[i].dir, spawnNodeID[i].hasShield);
                    newEnemyControllers.Add(newEnemy);
                }
                break;

            case EnemyType.BIDIRECTIONAL:
                for (int i = 0; i < spawnNodeID.Count; i++)
                {
                    Vector3          spawnLocation = pathService.GetNodeLocation(spawnNodeID[i].node);
                    IEnemyController newEnemy      = new BiDirectionalEnemyController(enemyService, pathService, gameService, spawnLocation, _enemyScriptableObject, spawnNodeID[i].node, spawnNodeID[i].dir, spawnNodeID[i].hasShield);
                    newEnemyControllers.Add(newEnemy);
                }
                break;


            case EnemyType.GUARD_TORCH:
                for (int i = 0; i < spawnNodeID.Count; i++)
                {
                    Vector3          spawnLocation = pathService.GetNodeLocation(spawnNodeID[i].node);
                    IEnemyController newEnemy      = new GuardWithTorchEnemyController(enemyService, pathService, gameService, spawnLocation, _enemyScriptableObject, spawnNodeID[i].node, spawnNodeID[i].dir, spawnNodeID[i].hasShield);
                    newEnemyControllers.Add(newEnemy);
                }
                break;

            default:

                break;
            }

            return(newEnemyControllers);
        }