Ejemplo n.º 1
0
 public PlayerBehaviourBuilder WithTailBehaviours(IPlayerBehaviour tailBehaviour)
 {
     this._tailsBehaviours = new List <PlayerBehaviourContainer>
     {
         new PlayerBehaviourContainer(0, tailBehaviour)
     };
     return(this);
 }
Ejemplo n.º 2
0
 public PlayerBuilder WithBehaviour(IPlayerBehaviour behaviour)
 {
     if (behaviour == null)
     {
         throw new ArgumentNullException("Player behavior is null");
     }
     _playerBehave = behaviour;
     return(this);
 }
Ejemplo n.º 3
0
 private void Construct(ISceneService sceneService, IPlayerBehaviour playerBehaviour,
                        ButtonUIInput buttonUIInput, IPauseMenuService pauseMenuService, ITimer timer, IStatisticService statisticService)
 {
     this.sceneService     = sceneService;
     this.playerBehaviour  = playerBehaviour;
     this.buttonUIInput    = buttonUIInput;
     this.pauseMenuService = pauseMenuService;
     this.timer            = timer;
     this.statisticService = statisticService;
 }
Ejemplo n.º 4
0
 public void Initialize(IPlayerBehaviour playerBehaviour, ITimingManager timingManager,
                        ProjectileBehaviour.Pool projectilePool)
 {
     _playerBehaviour = playerBehaviour;
     _timingManager   = timingManager;
     _projectilePool  = projectilePool;
     if (_opponent == null)
     {
         gameObject.SetActive(false);
     }
 }
Ejemplo n.º 5
0
        public bool Interact(IPlayerBehaviour _player)
        {
            if (!isHacked && !isBeingHack)
            {
                isBeingHack     = true;
                hackProgression = 0;

                // Display Hack UI.
                canvas.SetActive(true);
                gauge.fillAmount = 0;

                _player.Hack(this);
                AkSoundEngine.PostEvent(hackLoopStart_ID, gameObject);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
        public GameController(IAsteroidsManager asteroidsManager, Player player, GameStateData gameStateData,
                              IPlayerBehaviour playerBehaviour, ITimingManager timingManager, IGameInput gameInput,
                              IOpponentBehaviour opponentBehaviour, IBoundProvider boundProvider)
        {
            _asteroidsManager  = asteroidsManager;
            _player            = player;
            _gameStateData     = gameStateData;
            _playerBehaviour   = playerBehaviour;
            _timingManager     = timingManager;
            _gameInput         = gameInput;
            _opponentBehaviour = opponentBehaviour;
            _boundProvider     = boundProvider;

            _player.Death += OnDeath;
            _asteroidsManager.AsteroidDespawned += OnAsteroidDespawn;
            _gameInput.RestartPressed           += OnRestartPressed;

            StartGame();
        }
Ejemplo n.º 7
0
        public virtual bool CastDetection()
        {
            PlayerGhost _ghost = null;

            for (int i = 0; i < fieldOfView.Length; i++)
            {
                int _amount = Physics2D.RaycastNonAlloc(transform.position, transform.rotation * fieldOfView[i], detectionCast, range, detectionMask.value);

                for (int _j = 0; _j < _amount; _j++)
                {
                    if (detectionCast[_j].collider.TryGetComponent(out PlayerController _player))
                    {
                        if (target == null)
                        {
                            PlayDetectionSound();
                        }
                        target          = _player;
                        TargetTransform = detectionCast[_j].collider.transform;
                        return(true);
                    }
                    else if (detectionCast[_j].collider.TryGetComponent(out PlayerGhost _testGhost))
                    {
                        // IS OK
                        _ghost = _testGhost;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if (_ghost && target == null)
            {
                target          = _ghost;
                TargetTransform = _ghost.transform;
                PlayDetectionSound();
                return(true);
            }

            return(false);
        }
Ejemplo n.º 8
0
        // -----------------------

        public bool Interact(IPlayerBehaviour _player)
        {
            if (!isInteract)
            {
                isInteract = true;
                OnInteract.Invoke();
                info.SetActive(false);

                if (isSwitch)
                {
                    AkSoundEngine.PostEvent(Switch_ID, gameObject);
                }
                else if (isLever)
                {
                    AkSoundEngine.PostEvent(Lever_ID, gameObject);
                }

                return(true);
            }
            return(false);
        }
Ejemplo n.º 9
0
        public void ChangeState(PlayerState state)
        {
            if (_behaviour != null && _behaviour.IsState(state))
            {
                return;
            }

            _behaviour?.OnTransitionOut();

            if (!_behaviours.ContainsKey(state))
            {
                switch (state)
                {
                case PlayerState.Idle:
                    _behaviours.Add(state, new IdlePlayerBehaviour());
                    break;

                case PlayerState.Moving:
                    _behaviours.Add(state, new MovingPlayerBehaviour());
                    break;

                case PlayerState.Attacking:
                    _behaviours.Add(state, new AttackingPlayerBehaviour());
                    break;

                case PlayerState.Dating:
                    _behaviours.Add(state, new DatingPlayerBehaviour());
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(state), state, null);
                }
            }

            _behaviour = _behaviours[state];

            _behaviour.OnTransitionIn(this);
        }
Ejemplo n.º 10
0
 public GameFlow(
     IGameStateProvider gameStateProvider,
     IGameNotifications gameNotifications,
     IGameModeBehaviour gameModeBehaviour,
     IGameModeConfigurationProvider gameModeConfigurationProvider,
     IInputController inputController,
     IUiViewProvider uiViewProvider,
     ILevelSetup levelSetup,
     ILevelBehaviour levelBehaviour,
     IPlayerBehaviour playerBehaviour,
     IAddScore addScore)
 {
     _gameStateProvider = gameStateProvider;
     _gameNotifications = gameNotifications;
     _gameModeBehaviour = gameModeBehaviour;
     _gameModeConfigurationProvider = gameModeConfigurationProvider;
     _inputController = inputController;
     _uiViewProvider = uiViewProvider;
     _levelSetup = levelSetup;
     _levelBehaviour = levelBehaviour;
     _playerBehaviour = playerBehaviour;
     _addScore = addScore;
 }
Ejemplo n.º 11
0
 public Player(IPlayerBehaviour behaviour) : this(Guid.NewGuid().ToString(), behaviour)
 {
 }
Ejemplo n.º 12
0
 public Player(string name, IPlayerBehaviour behaviour)
 {
     _behaviour = behaviour;
     Name       = name;
 }
Ejemplo n.º 13
0
 public void SetTarget(IPlayerBehaviour _target, Transform _targetTransform)
 {
     target          = _target;
     TargetTransform = _targetTransform;
 }
Ejemplo n.º 14
0
 public PlayerBehaviourContainer(int priority, IPlayerBehaviour behaviour)
 {
     Priority  = priority;
     Behaviour = behaviour;
 }
Ejemplo n.º 15
0
 public bool Interact(IPlayerBehaviour _player)
 {
     IsActivated = !IsActivated;
     linkedDoor.UpdateOpenningStatus();
     return(true);
 }
Ejemplo n.º 16
0
 public PlayerBuilder WithGetNewCardBehaviour()
 {
     _playerBehave = new GetNewCardBahaviour();
     return(this);
 }
Ejemplo n.º 17
0
 public PlayerControler(IPlayerBehaviour view, IPlayerData data)
 {
     this.view = view;
     this.data = data;
 }
Ejemplo n.º 18
0
 public PlayerBuilder WithMoveAnotherPlayerCardForwardBehaviour()
 {
     _playerBehave = new MoveAnotherPlayerCardForwardBehaviour();
     return(this);
 }
Ejemplo n.º 19
0
 private void Construct(IPlayerBehaviour playerBehaviour)
 {
     this.playerBehaviour = playerBehaviour;
 }