예제 #1
0
        public void CanMakeRoundManagerWithExpectedNumberOfRounds()
        {
            const int expectedNumberOfRounds = 1;
            var       manager = new RoundKeeper(expectedNumberOfRounds);

            Assert.Equal(expectedNumberOfRounds, manager.MaximumRounds);
        }
예제 #2
0
        public void CanMakeRoundManager()
        {
            const int numberOfRounds = 1;
            var       manager        = new RoundKeeper(numberOfRounds);

            Assert.NotNull(manager);
        }
예제 #3
0
        public void Can_enroll_new_participant_when_there_is_no_active_round()
        {
            var roundKeeper = new RoundKeeper();
            var participant = new Participant("NEW");

            roundKeeper.Enroll(participant);

            Assert.That(roundKeeper.HasActiveRound, "roundkeeper has active round");
            Assert.That(roundKeeper.ActiveRound.Status.ParticipantCount, Is.EqualTo(1), "round participant count");
        }
예제 #4
0
        public void CanIncreaseRound()
        {
            const int maxNumberOfRounds = 1;
            const int expectedRound     = 1;

            var manager = new RoundKeeper(maxNumberOfRounds);
            var result  = manager.NextRound();

            Assert.Equal(expectedRound, manager.Round);
            Assert.True(result);
        }
예제 #5
0
        public void Can_enroll_new_participant_when_there_is_an_active_non_completed_round()
        {
            var roundKeeper  = new RoundKeeper();
            var participant1 = new Participant("ONE");
            var participant2 = new Participant("TWO");

            roundKeeper.Enroll(participant1);

            roundKeeper.Enroll(participant2);

            Assert.That(roundKeeper.ActiveRound.Status.ParticipantCount, Is.EqualTo(2), "round participant count");
        }
예제 #6
0
        public void Starts_new_round_when_enrolling_new_participant_when_active_roud_is_completed()
        {
            var roundKeeper                   = new RoundKeeper();
            var currentRoundParticipant       = new Participant("ACTIVE");
            var newRoundInitiatingParticipant = new Participant("NEW");

            roundKeeper.Enroll(currentRoundParticipant);
            currentRoundParticipant.Estimate(StoryPoints.One);

            roundKeeper.Enroll(newRoundInitiatingParticipant);

            Assert.That(roundKeeper.ActiveRound.Status.ParticipantCount, Is.EqualTo(2), "participant count");
            Assert.That(roundKeeper.ActiveRound.Status.EstimateCount, Is.EqualTo(0), "estimate count");
        }
예제 #7
0
        void Start()
        {
            if (isLocalPlayer)
            {
                DisableControls = false;
                gameObject.GetComponent<AudioSource>().enabled = true;
                MyCamera.SetActive(true);
            }

            _spawnRotation = transform.rotation;
            _spawnPosition = transform.position;
            HealthIndicator.SetHealth(100);
            _firstPersonUi = (GameObject)Instantiate(Resources.Load("UI"));
            _healthBar =
                _firstPersonUi.transform.GetComponentsInChildren<RadialSlider>().First(s => s.tag == "HealthBar");
            //_healthBar = GameObject.FindGameObjectWithTag("HealthBar").GetComponent<RadialSlider>();
            //_reloadBar = GameObject.FindGameObjectWithTag("ReloadBar").GetComponent<RadialSlider>();
            _reloadBar =
                _firstPersonUi.transform.GetComponentsInChildren<RadialSlider>().First(s => s.tag == "ReloadBar");
            _reloadBar.gameObject.SetActive(false);
            _rb = gameObject.GetComponent<Rigidbody>();
            _health = Health;
            _mineAmount = MineStartAmount;
            _mineBar = _firstPersonUi.transform.GetComponentsInChildren<UiMineController>().First(s => s.tag == "MinesBar");
            _missileBar = _firstPersonUi.transform.GetComponentsInChildren<UiMissileController>().First(s => s.tag == "MissilesBar");
            _missileAmount = MissileStartAmount;
            //_mineBar = GameObject.FindGameObjectWithTag("MinesBar").GetComponent<UiMineController>();
            _mineBar.SetAvailableMines(_mineAmount);
            UpdateCameraMode();
            if (_weapon == null)
                _weapon = GameObject.FindGameObjectWithTag("GameScripts").GetComponent<BulletManager>();
            if (_missiles == null)
                _missiles = GameObject.FindGameObjectWithTag("GameScripts").GetComponent<MissileManager>();

            networkId = (short)GetComponent<NetworkIdentity>().netId.Value;
            _roundKeeper = GameObject.FindObjectOfType<RoundKeeper>();
        }
예제 #8
0
        public void Fresh_roundkeeper_has_no_active_round()
        {
            var roundKeeper = new RoundKeeper();

            Assert.That(roundKeeper.HasActiveRound, Is.False, "roundkeeper has active round");
        }
예제 #9
0
        void Start()
        {
            NetworkId = (short)GetComponent<NetworkIdentity>().netId.Value;

            if (!isServer)
                return;

            GetComponent<NavMeshAgent>().enabled = true;
            InitiateSoundSettings();
            _bc = GameObject.FindGameObjectWithTag("GameScripts").GetComponent<BulletManager>();

            var allWaypoints = GameObject.FindGameObjectsWithTag(Constants.Tags.Waypoint).ToList();
            var selectedWapoints = allWaypoints.Select(go => go.transform)
                .OrderBy(t => Random.Range(0, allWaypoints.Count))
                .Take(NumberOfWaypoints)
                .ToList();

            _nav = GetComponent<NavMeshAgent>();
            _chaseState = new ChaseState(_nav);
            _patrolState = new PatrolState(_nav, selectedWapoints);
            _currentState = _patrolState;

            _spawnPos = transform.position;
            _spawnRot = transform.rotation;

            GameObject.FindGameObjectsWithTag("Waypoint");
            _roundKeeper = FindObjectOfType<RoundKeeper>();
        }
예제 #10
0
 private void Start()
 {
     _text = GetComponent<Text>();
     rc = FindObjectOfType<RoundKeeper>();
     FindPlayer();
 }