Example #1
0
    protected override void OnStart()
    {
        base.OnStart();
        bombManager = GetComponent <BombManager>();
        if (transform.root.gameObject.name.Contains("Balloom"))
        {
            enemy = new Balloom(transform.root.gameObject);
        }
        else if (transform.root.gameObject.name.Contains("Oneal"))
        {
            enemy = new Oneal(transform.root.gameObject);
        }
        playerPosition = GameObject.FindGameObjectWithTag("Player").transform.position;
        path           = new List <Vector3>();

        if (enemy.intelligence == Smart.Low)
        {
            intelligentSystem = new IntelligentSystemBase(enemy);
        }
        else if (enemy.intelligence == Smart.High)
        {
            intelligentSystem = new AdvancedIntelligentSystem(enemy);
        }
        audioSource = GetComponentInChildren <AudioSource>();
    }
Example #2
0
 public Abilities(
     IStrength strength,
     IDexterity dexterity,
     IConstitution constitution,
     IIntelligence intelligence,
     IWisdom wisdom,
     ICharisma charisma)
 {
     Strength     = strength ?? throw new ArgumentNullException(nameof(strength));
     Dexterity    = dexterity ?? throw new ArgumentNullException(nameof(dexterity));
     Constitution = constitution ?? throw new ArgumentNullException(nameof(constitution));
     Intelligence = intelligence ?? throw new ArgumentNullException(nameof(intelligence));
     Wisdom       = wisdom ?? throw new ArgumentNullException(nameof(wisdom));
     Charisma     = charisma ?? throw new ArgumentNullException(nameof(charisma));
 }
Example #3
0
        public Ghost(IIntelligence intelligence, IParlance parlance, IDemeanor demeanor, BaloonWindow baloon, ShellWindow shell)
        {
            _intelligence = intelligence;
            _parlance     = parlance;
            _demeanor     = demeanor;
            _baloon       = baloon;
            _shell        = shell;

            _inputQueue.Dispatched  += InputDispatched;
            _outputQueue.Dispatched += OutputDispatched;
            _intelligence.Output    += IntelligenceOutput;
            _shell.ScreenChanged    += ShellScreenChanged;
            _shell.Rendered         += ShellRendered;

            _demeanor.Loaded(shell);
            _intelligence.Loaded();
        }
Example #4
0
        public IEnumerable <IPlayer> Create(GameSettings gameSettings, IIntelligence ai)
        {
            var playerSettings = gameSettings.PlayerSettings ?? BuildDefaultPlayerSettings(gameSettings, ai);

            switch (gameSettings.GamePlayerType)
            {
            case GamePlayerType.HumanVsHuman:
                return(CreateHumanVsHuman(playerSettings).OrderBy(gameSettings.PlayerStartType));

            case GamePlayerType.ComputerVsComputer:
                return(CreateComputerVsComputer(playerSettings).OrderBy(gameSettings.PlayerStartType));

            case GamePlayerType.HumanVsComputer:
                return(CreateHumanVsComputer(playerSettings).OrderBy(gameSettings.PlayerStartType));

            default:
                throw new ArgumentException("invalid game player type");
            }
        }
Example #5
0
    private void Start()
    {
        var idle = new IdleState(transform);
        var seek = new SeekState(transform);
        var hit  = new HitState(transform);

        idle.Transitions.AddRange(new[]
        {
            new Transition(seek, seek.IsBallSeekable)
        });

        seek.Transitions.AddRange(new[]
        {
            new Transition(idle, seek.IsBallSeekable, true),
            new Transition(hit, hit.IsBallHittable),
        });

        hit.Transitions.AddRange(new []
        {
            new Transition(idle, hit.IsBallHittable, true),
        });

        _enemyAi = new StateMachine(idle);
    }
Example #6
0
 public void VerifyCreatedCalled(GameSettings gameSettings, IIntelligence ai, int times = 1)
 {
     _mock.Verify(m => m.Create(gameSettings, ai), Times.Exactly(times));
 }
Example #7
0
 public IEnumerable <IPlayer> Create(GameSettings gameSettings, IIntelligence ai)
 {
     return(_mock.Object.Create(gameSettings, ai));
 }
Example #8
0
        private IEnumerable <PlayerSettings> BuildDefaultPlayerSettings(GameSettings gameSettings, IIntelligence ai)
        {
            var player1Number       = gameSettings.GamePlayerType == GamePlayerType.HumanVsComputer ? string.Empty : "1";
            var player1Type         = gameSettings.GamePlayerType == GamePlayerType.ComputerVsComputer ? DEFAULT_COMPUTER_NAME : DEFAULT_HUMAN_NAME;
            var player1Intelligence = gameSettings.GamePlayerType != GamePlayerType.ComputerVsComputer ? _humanAi : ai;

            yield return(new PlayerSettings {
                Name = $"{player1Number} {player1Type}",
                Symbol = DEFAULT_SYMBOL_1,
                Intelligence = player1Intelligence
            });

            var player2Number       = gameSettings.GamePlayerType == GamePlayerType.HumanVsComputer ? string.Empty : "2";
            var player2Type         = gameSettings.GamePlayerType == GamePlayerType.HumanVsHuman ? DEFAULT_HUMAN_NAME : DEFAULT_COMPUTER_NAME;
            var player2Intelligence = gameSettings.GamePlayerType != GamePlayerType.HumanVsHuman ? ai : _humanAi;

            yield return(new PlayerSettings {
                Name = $"{player2Number} {player2Type}",
                Symbol = DEFAULT_SYMBOL_2,
                Intelligence = player2Intelligence
            });
        }
Example #9
0
 public PlayersFactory(IHumanIntelligence humanAI)
 {
     _humanAi = humanAI;
 }
Example #10
0
 public MockIntelligenceFactory CreateStubbedToReturn(IIntelligence ai)
 {
     _mock.Setup(m => m.Create(It.IsAny <GameSettings>())).Returns(ai);
     return(this);
 }
Example #11
0
 public MockPlayer GetIntelligenceStubbedToReturn(IIntelligence ai)
 {
     _mock.Setup(m => m.GetIntelligence()).Returns(ai);
     return(this);
 }
Example #12
0
 protected Player(PlayerSettings settings)
 {
     Name   = settings.Name;
     Symbol = settings.Symbol;
     AI     = settings.Intelligence;
 }
 static public Abilities GetAbilities(IStrength strength, IDexterity dexterity, IConstitution constitution, IIntelligence intelligence, IWisdom wisdom, ICharisma charisma)
 {
     return(new Abilities()
     {
         Strength = strength,
         Dexterity = dexterity,
         Constitution = constitution,
         Intelligence = intelligence,
         Wisdom = wisdom,
         Charisma = charisma
     });
 }