Пример #1
0
        public void FindScoutsWith()
        {
            // arrange
            Scout        scout1  = new Scout(new DateTime(), "John", "Doe", 1);
            Scout        scout2  = new Scout(new DateTime(), "Jane", "Doe", 5);
            List <Scout> members = new List <Scout>()
            {
                scout1, scout2
            };
            Scout leader = new Scout(new DateTime(), "Jane", "Doe", 1);
            Group group1 = new Group(null, leader, members);
            Group group2 = new Group(null, leader, members);

            Scout        captain = new Scout(new DateTime(), "John", "Doe", 2);
            List <Group> groups  = new List <Group>()
            {
                group1, group2
            };
            Corps corps = new Corps(captain, groups);

            byte marksToFind = 1;

            Scout[] expected = new Scout[2] {
                scout1, scout1
            };

            // act
            Scout[] actual = corps.FindScoutsWith(marksToFind);

            // assert
            CollectionAssert.AreEquivalent(expected, actual);
        }
Пример #2
0
        public void ToStringTest()
        {
            // arrange
            Scout        scout1  = new Scout(new DateTime(), "John", "Doe", 1);
            Scout        scout2  = new Scout(new DateTime(), "Jane", "Doe", 5);
            List <Scout> members = new List <Scout>()
            {
                scout1, scout2
            };
            Scout leader = new Scout(new DateTime(), "Jane", "Doe", 1);
            Group group1 = new Group(null, leader, members);
            Group group2 = new Group(null, leader, members);

            Scout        captain = new Scout(new DateTime(), "John", "Doe", 2);
            List <Group> groups  = new List <Group>()
            {
                group1, group2
            };
            Corps corps = new Corps(captain, groups);

            string expected = $"Captain: {corps.Captain.FirstName} {corps.Captain.LastName}, Groups: {groups.Count}, Marks: {corps.TotalMarks}";

            // act
            string actual = corps.ToString();

            // assert
            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public void TestMinerScout()
        {
            Piece att = new Miner(Ownership.FirstPlayer);
            Piece def = new Scout(Ownership.SecondPlayer);

            Assert.True(att == ConflictHandler.Handle(att, def));
        }
Пример #4
0
 public Scout AddScout(Scout scout)
 {
     scout.Id = Guid.NewGuid();
     repository.Create(scout);
     repository.SaveChanges();
     return(scout);
 }
Пример #5
0
        public static Specialization GetSpecialization(SpecializationType type)
        {
            if (specializations[(int)type] == null)
            {
                switch (type)
                {
                case SpecializationType.None:
                    specializations[(int)type] = new None();
                    break;

                case SpecializationType.Forager:
                    specializations[(int)type] = new Forager();
                    break;

                case SpecializationType.Guard:
                    specializations[(int)type] = new Guard();
                    break;

                case SpecializationType.Inkeeper:
                    specializations[(int)type] = new Inkeeper();
                    break;

                case SpecializationType.Scout:
                    specializations[(int)type] = new Scout();
                    break;

                default:
                    break;
                }
            }
            return(specializations[(int)type]);
        }
Пример #6
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        Scout tempScout = gameObject.transform.parent.GetComponent <Scout>();

        if (collision.gameObject.name == "ufo1(Clone)")
        {
            tempScout.b_chasingUFO = false;
            b_colIsUFO1            = false;
        }
        if (collision.gameObject.name == "ufo2(Clone)")
        {
            tempScout.b_chasingUFO = false;
            b_colIsUFO2            = false;
        }
        if (collision.gameObject.name == "ufo3(Clone)")
        {
            tempScout.b_chasingUFO = false;
            b_colIsUFO3            = false;
        }

        if (collision.gameObject.tag == "ASTEROID")
        {
            tempScout.b_chasingAsteroid = false;
            b_colIsAsteriod1            = false;
        }

        if (collision.gameObject.tag == "ASTEROID2")
        {
            tempScout.b_chasingAsteroid = false;
            b_colIsAsteroid2            = false;
        }
    }
Пример #7
0
 private void FixedUpdate()
 {
     if (b_colIsUFO1 == true || b_colIsUFO2 == true || b_colIsUFO3 == true || b_colIsAsteriod1 == true || b_colIsAsteroid2 == true)
     {
         f_counter -= Time.deltaTime;
     }
     if (f_counter <= 0)
     {
         Scout tempScout = gameObject.transform.parent.GetComponent <Scout>();
         if (this.gameObject.GetComponentInParent <Scout>().gameObject.name == "scout1")
         {
             b_colIsUFO1                 = false;
             b_colIsUFO2                 = false;
             b_colIsUFO3                 = false;
             b_colIsAsteriod1            = false;
             b_colIsAsteroid2            = false;
             tempScout.b_chasingUFO      = false;
             tempScout.b_chasingAsteroid = false;
             tempScout.b_GunSound        = false;
             f_counter = 0.2f;
         }
         if (this.gameObject.GetComponentInParent <Scout>().gameObject.name == "scout2")
         {
             b_colIsUFO1                 = false;
             b_colIsUFO2                 = false;
             b_colIsUFO3                 = false;
             b_colIsAsteriod1            = false;
             b_colIsAsteroid2            = false;
             tempScout.b_chasingUFO      = false;
             tempScout.b_chasingAsteroid = false;
             tempScout.b_GunSound        = false;
             f_counter = 0.2f;
         }
         if (this.gameObject.GetComponentInParent <Scout>().gameObject.name == "scout3")
         {
             b_colIsUFO1                 = false;
             b_colIsUFO2                 = false;
             b_colIsUFO3                 = false;
             b_colIsAsteriod1            = false;
             b_colIsAsteroid2            = false;
             tempScout.b_GunSound        = false;
             tempScout.b_chasingUFO      = false;
             tempScout.b_chasingAsteroid = false;
             f_counter = 0.2f;
         }
         if (this.gameObject.GetComponentInParent <Scout>().gameObject.name == "scout4")
         {
             b_colIsUFO1                 = false;
             b_colIsUFO2                 = false;
             b_colIsUFO3                 = false;
             b_colIsAsteriod1            = false;
             b_colIsAsteroid2            = false;
             tempScout.b_GunSound        = false;
             tempScout.b_chasingUFO      = false;
             tempScout.b_chasingAsteroid = false;
             f_counter = 0.2f;
         }
     }
 }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        scout = new Scout();
        t     = scoutDelay;

        instance = this;
        Regenerate();
    }
Пример #9
0
    static void Main()
    {
        Scout scout1 = new Scout();

        scout1.FirstName = "bill";
        scout1.LastName  = "Codner";
        Console.WriteLine("{0} {1}", scout1.FirstName, scout1.LastName);
        Console.WriteLine(scout1.FullName);
    }
Пример #10
0
        public void ShouldThrowArgumentOutOfRangeExceptionWhenGivenFutureDateForBirthday()
        {
            //Arrange
            Scout    validScout      = GetValidScout();
            DateTime invalidBirthday = DateTime.Now.AddDays(1);

            //Act & Assert
            validScout.Birthday = invalidBirthday;
        }
Пример #11
0
        public void TestFailOnAttackerBomb_ThrowsPieceConflictHandlerException()
        {
            Piece att = new Bomb(Ownership.FirstPlayer);
            ICell def = new Scout(Ownership.SecondPlayer);

            TestDelegate code = () => ConflictHandler.Handle(att, def);

            Assert.Throws(typeof(PieceConflictHandlerException), code);
        }
Пример #12
0
 public ShipsBundle()
 {
     Bomber = new Bomber();
     Carrier = new Carrier();
     Fighter = new Fighter();
     Interceptor = new Interceptor();
     Juggernaut = new Juggernaut();
     Scout = new Scout();
 }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Scout tempScout = gameObject.transform.parent.GetComponent <Scout>();

        if (collision.gameObject.tag == "ENEMYBULLET" && tempScout.gameObject.name == "scout1")
        {
            FindObjectOfType <AudioManager>().Play("shipExplosion");
            tempScout.DestroyScout();
        }
    }
Пример #14
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Scout tempScout = gameObject.transform.parent.GetComponent <Scout>();

        if ((tempScout.gameObject.name == "scout1" && collision.gameObject.name == "laserUFO1") || (tempScout.gameObject.name == "scout1" && collision.gameObject.name == "laserUFO2") || (tempScout.gameObject.name == "scout1" && collision.gameObject.name == "laserUFO3"))
        {
            Debug.Log("AVOID SYSTEM WORKS!!!");

            b_avoidUFOAtack = true;
        }
    }
Пример #15
0
 protected TroopMember()
 {
     Scout       = new Scout();
     Tenderfoot  = new Tenderfoot();
     SecondClass = new SecondClass();
     FirstClass  = new FirstClass();
     Star        = new Star();
     Life        = new Life();
     Eagle       = new Eagle();
     EaglePalms  = new List <Palm>();
     MeritBadges = new List <MeritBadge>();
 }
        public async Task <IActionResult> Create([Bind("ScoutID,ScoutName,PlayerID,CountryBased,StaffAmount")] Scout scout)
        {
            if (ModelState.IsValid)
            {
                _context.Add(scout);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PlayerID"] = new SelectList(_context.Players, "PlayerID", "PlayerID", scout.PlayerID);
            return(View(scout));
        }
Пример #17
0
        public void TestSharpshooterWeapons()
        {
            IWeapon w1 = new Scout();
            IWeapon w2 = new AWP();

            Assert.IsTrue(w1.GetAttack() < w2.GetAttack());
            Sharpshooter s = new Sharpshooter();

            Assert.AreEqual(s.GetAttack(), w1.GetAttack());
            s.UpgradeWeapon();
            Assert.AreEqual(s.GetAttack(), w2.GetAttack());
        }
Пример #18
0
        public void ScoutControllerSave()
        {
            Create();
            var input = new Scout {
                Balance = 45, FirstName = "Fred", Active = true
            };

            _repository.Setup(x => x.Save(input))
            .Verifiable();

            _controller.Post(input);
            _repository.Verify(x => x.Save(input));
        }
Пример #19
0
        public void ToStringTest()
        {
            // arrange
            DateTime birthday = new DateTime();
            Scout    scout    = new Scout(birthday, "Jon", "Doe", 0);
            string   expected = $"Name: {scout.FirstName} {scout.LastName}, Birthday: {scout.Birthday}, Marks: {scout.Marks}";

            // act
            string actual = scout.ToString();

            // assert
            Assert.AreEqual(expected, actual);
        }
Пример #20
0
        public void ShouldReturnOneHigherForIceListWhenAddingRelative()
        {
            //Arrange
            Scout    validScout     = GetValidScout();
            Relative validRelative  = GetValidRelative();
            int      startCountIce  = validScout.Ices.Count;
            int      expectedResult = startCountIce + 1;
            int      actualResult;

            //Act
            actualResult = validScout.AddIce(validRelative);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
Пример #21
0
        // CREATE
        public bool CreateScout(ScoutCreate model)
        {
            var entity =
                new Scout()
            {
                FirstName = model.FirstName,
                LastName  = model.LastName
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Scouts.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
Пример #22
0
        public void ToStringTest()
        {
            // arrange
            string       name     = null;
            Scout        leader   = new Scout(new DateTime(), "John", "Doe", 0);
            List <Scout> members  = new List <Scout>();
            Group        group    = new Group(name, leader, members);
            string       expected = $"Name: {name}, Leader: {leader.FirstName} {leader.LastName}, Members: {members.Count}";

            // act
            string actual = group.ToString();

            // assert
            Assert.AreEqual(expected, actual);
        }
Пример #23
0
 public static void DoStartup()
 {
     EACServer.client2connection.Clear();
     EACServer.connection2client.Clear();
     EACServer.connection2status.Clear();
     Log.SetOut(new StreamWriter(string.Concat(ConVar.Server.rootFolder, "/Log.EAC.txt"), false)
     {
         AutoFlush = true
     });
     Log.Prefix = "";
     Log.Level  = EasyAntiCheat.Server.LogLevel.Info;
     EACServer.easyAntiCheat = new EasyAntiCheatServer <EasyAntiCheat.Server.Hydra.Client>(new EasyAntiCheatServer <EasyAntiCheat.Server.Hydra.Client> .ClientStatusHandler(EACServer.HandleClientUpdate), 20, ConVar.Server.hostname);
     EACServer.playerTracker = EACServer.easyAntiCheat.Cerberus;
     EACServer.playerTracker.LogGameRoundStart(World.Name, string.Empty, 0);
     EACServer.eacScout = new Scout();
 }
Пример #24
0
        IEnumerator IntroSpeech()
        {
            warMasterInstance    = Instantiate(warMaster, mainCanvasTransform);
            warMasterSpeech      = warMasterInstance.GetComponentInChildren <Text>();
            warMasterSpeech.text = warMasterIntroTalk[speechNumber];
            speechNumber++;
            yield return(new WaitUntil(() => Input.GetMouseButtonDown(0)));

            Scout theScout = Instantiate(scout, scoutPlacement, Quaternion.identity);

            theScout.Died       += StartGodFriendshipSpeech;
            warMasterSpeech.text = warMasterIntroTalk[speechNumber];
            yield return(new WaitUntil(() => speechNumber == 2));

            warMasterSpeech.text = warMasterIntroTalk[speechNumber];
        }
Пример #25
0
 public void Progress()
 {
     level++;
     _roomsSoFar = 0;
     Destroy(GameManager.instance.player);
     if (dungeon_rooms.Count > 0)
     {
         for (int i = 0; i < dungeon_rooms.Count; i++)
         {
             Destroy(dungeon_rooms[i].gameObject);
         }
         dungeon_rooms.Clear();
     }
     scout = new Scout();
     Regenerate();
 }
Пример #26
0
    public void EnterAutoData()
    {
        Scout[] scouts       = FindObjectsOfType <Scout>();
        Scout[] ActiveScouts = new Scout[6];

        //Find all the active scouts
        int counter = 0;

        foreach (Scout s in scouts)
        {
            if (s.gameObject.activeInHierarchy)
            {
                ActiveScouts[counter] = s;
                counter++;
            }
        }
    }
Пример #27
0
        public void AddScout()
        {
            // arrange
            string       name                 = null;
            Scout        leader               = new Scout(new DateTime(), "John", "Doe", 0);
            Scout        scoutToAdd           = new Scout(new DateTime(), "John", "Doe", 0);
            List <Scout> members              = new List <Scout>();
            int          expectedMembersCount = 1;
            Group        group                = new Group(name, leader, members);

            // act
            group.AddScout(scoutToAdd);
            int actualMembersCount = group.Members.Count;

            // assert
            Assert.AreEqual(expectedMembersCount, actualMembersCount);
        }
Пример #28
0
        public override void OnAosSingleClick(Mobile from)
        {
            base.OnSingleClick(from);

            if (from is Player)
            {
                Scout sct = Perk.GetByType <Scout>((Player)from);

                if (sct != null)
                {
                    if (this.HasTrap() && sct.LabelTrappedDoor(this))
                    {
                        this.LabelTo(from, "[Trapped]");
                    }
                }
            }
        }
Пример #29
0
        public void ScoutRepositorySave()
        {
            Create();

            var scout = new Scout {
                Balance = 50, FirstName = "test", ScoutId = 0, Active = true
            };

            _context.Setup(x => x.SetModified(It.IsAny <object>()));

            _context.Setup(x => x.SaveChanges()).Verifiable();

            _repository = new ScoutRepository(_context.Object);

            _repository.Save(scout);

            _context.Verify(x => x.SaveChanges(), Times.Once);
        }
Пример #30
0
        public void AddGroup()
        {
            // arrange
            Scout        captain            = new Scout(new DateTime(), "John", "Doe", 2);
            List <Group> groups             = new List <Group>();
            Corps        corps              = new Corps(captain, groups);
            Scout        leader             = new Scout(new DateTime(), "Jane", "Doe", 1);
            List <Scout> members            = new List <Scout>();
            Group        groupToAdd         = new Group(null, leader, members);
            int          expectedGroupCount = 1;

            // act
            corps.AddGroup(groupToAdd);
            int actualGroupCount = corps.Groups.Count;

            // assert
            Assert.AreEqual(expectedGroupCount, actualGroupCount);
        }
Пример #31
0
 public static void DoShutdown()
 {
     client2connection.Clear();
     connection2client.Clear();
     connection2status.Clear();
     if (eacScout != null)
     {
         Debug.Log("EasyAntiCheat Scout Shutting Down");
         eacScout.Dispose();
         eacScout = null;
     }
     if (easyAntiCheat != null)
     {
         Debug.Log("EasyAntiCheat Server Shutting Down");
         easyAntiCheat.Dispose();
         easyAntiCheat = null;
     }
 }