void createCats() { Vector2 currentOffset = new Vector2(-1, -1); while (InventoryController.instance.PistolCats > 0) { FollowerController newCat = Instantiate(PistolCat, GetComponent <Rigidbody2D>().position, Quaternion.Euler(0f, 0f, 0f)).GetComponent <FollowerController>(); currentOffset = getNextOffset(currentOffset); newCat.initialize(currentOffset); InventoryController.instance.PistolCats--; } while (InventoryController.instance.SniperCats > 0) { FollowerController newCat = Instantiate(SniperCat, GetComponent <Rigidbody2D>().position, Quaternion.Euler(0f, 0f, 0f)).GetComponent <FollowerController>(); currentOffset = getNextOffset(currentOffset); newCat.initialize(currentOffset); InventoryController.instance.SniperCats--; } while (InventoryController.instance.RifleCats > 0) { FollowerController newCat = Instantiate(RifleCat, GetComponent <Rigidbody2D>().position, Quaternion.Euler(0f, 0f, 0f)).GetComponent <FollowerController>(); currentOffset = getNextOffset(currentOffset); newCat.initialize(currentOffset); InventoryController.instance.RifleCats--; } }
public async void Patch_No_Errors() { FollowerControllerMockFacade mock = new FollowerControllerMockFacade(); var mockResult = new Mock <UpdateResponse <ApiFollowerResponseModel> >(); mockResult.SetupGet(x => x.Success).Returns(true); mock.ServiceMock.Setup(x => x.Update(It.IsAny <int>(), It.IsAny <ApiFollowerRequestModel>())) .Callback <int, ApiFollowerRequestModel>( (id, model) => model.Blocked.Should().Be("A") ) .Returns(Task.FromResult <UpdateResponse <ApiFollowerResponseModel> >(mockResult.Object)); mock.ServiceMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ApiFollowerResponseModel>(new ApiFollowerResponseModel())); FollowerController controller = new FollowerController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, new ApiFollowerModelMapper()); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); var patch = new JsonPatchDocument <ApiFollowerRequestModel>(); patch.Replace(x => x.Blocked, "A"); IActionResult response = await controller.Patch(default(int), patch); response.Should().BeOfType <OkObjectResult>(); (response as OkObjectResult).StatusCode.Should().Be((int)HttpStatusCode.OK); mock.ServiceMock.Verify(x => x.Update(It.IsAny <int>(), It.IsAny <ApiFollowerRequestModel>())); }
public void Init() // initialize screen components { BackgroundColor = Constants.backgroundColor; LoginIcon.HeightRequest = Constants.LoginIconHeight; boxViewFollowing.Color = Constants.logoColor; followingController = new FollowerController(); }
public async void BulkInsert_No_Errors() { FollowerControllerMockFacade mock = new FollowerControllerMockFacade(); var mockResponse = new CreateResponse <ApiFollowerResponseModel>(new FluentValidation.Results.ValidationResult()); mockResponse.SetRecord(new ApiFollowerResponseModel()); mock.ServiceMock.Setup(x => x.Create(It.IsAny <ApiFollowerRequestModel>())).Returns(Task.FromResult <CreateResponse <ApiFollowerResponseModel> >(mockResponse)); FollowerController controller = new FollowerController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); var records = new List <ApiFollowerRequestModel>(); records.Add(new ApiFollowerRequestModel()); IActionResult response = await controller.BulkInsert(records); response.Should().BeOfType <OkObjectResult>(); (response as OkObjectResult).StatusCode.Should().Be((int)HttpStatusCode.OK); var result = (response as OkObjectResult).Value as List <ApiFollowerResponseModel>; result.Should().NotBeEmpty(); mock.ServiceMock.Verify(x => x.Create(It.IsAny <ApiFollowerRequestModel>())); }
private void OnTriggerEnter(Collider c) { if (c.gameObject.CompareTag("follower")) { followerController = c.gameObject.GetComponent <FollowerController>(); followerController.SetFollowerMaterial(followerMaterial); followerController.isPlayerFollower = isPlayer; followerController.PrayAtBanner(transform, player, isPlayer, bannerSecondaryColor); } }
public void FreeSlaves() { FollowerController followerController = GetComponent <FollowerController>(); followerController.enabled = true; followerController.gameObject.tag = "Human"; player.followers.Add(followerController); player.updateFollowerGUI(); this.enabled = false; }
public void GetFollowersRetunsNullWhenNoneFoundTest() { var data = new List <UserModel> { new UserModel() { Id = 1, Token = "aa", Username = "******", Password = "******", Email = "@gmail" }.HashPassword(), new UserModel() { Id = 2, Token = "aaa", Username = "******", Password = "******", Email = "2@gmail" }.HashPassword() }.AsQueryable(); var mockSet = new Mock <DbSet <UserModel> >(); mockSet.As <IQueryable <UserModel> >().Setup(m => m.Provider).Returns(data.Provider); mockSet.As <IQueryable <UserModel> >().Setup(m => m.Expression).Returns(data.Expression); mockSet.As <IQueryable <UserModel> >().Setup(m => m.ElementType).Returns(data.ElementType); mockSet.As <IQueryable <UserModel> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator()); var followerData = new List <FollowerModel> { new FollowerModel() { Id = 1, FollowedId = 2, FollowerId = 1 } }.AsQueryable(); var followerMockSet = new Mock <DbSet <FollowerModel> >(); followerMockSet.As <IQueryable <FollowerModel> >().Setup(m => m.Provider).Returns(followerData.Provider); followerMockSet.As <IQueryable <FollowerModel> >().Setup(m => m.Expression).Returns(followerData.Expression); followerMockSet.As <IQueryable <FollowerModel> >().Setup(m => m.ElementType).Returns(followerData.ElementType); followerMockSet.As <IQueryable <FollowerModel> >().Setup(m => m.GetEnumerator()).Returns(followerData.GetEnumerator()); var options = new DbContextOptionsBuilder <MyDbContext>() .Options; var mockContext = new Mock <MyDbContext>(options); mockContext.Setup(x => x.Users).Returns(mockSet.Object); mockContext.Setup(x => x.Followers).Returns(followerMockSet.Object); mockContext.SetupProperty(x => x.Trips); mockContext.SetupProperty(x => x.PinPoints); var service = new FollowerController(mockContext.Object); var result = service.GetFollowers(2); Assert.IsNull(result.Result.Value); }
private void Start() { if (!IsController) { return; } //还原存档数据 if (DataCenter.Get("scene") == SceneManager.GetActiveScene().name) { if (GameConfig.Loaded) { return; } GameConfig.RecoverSceneFromString(DataCenter.Get("scenecode")); Direction = int.Parse(DataCenter.Get("mapdirection", "0")); Transform pp = GameObject.Find("Player").transform; pp.position = new Vector3(int.Parse(DataCenter.Get("mapx", "0")), pp.position.y, int.Parse(DataCenter.Get("mapz", "0"))); s.sprite = walker[1 + 3 * Direction]; CircleCanvas.SetActive(false); } if (IsController) { GameConfig.Followers.Clear(); GameObject Player = GameObject.Find("Player"); GameConfig.PlayerState ps = new GameConfig.PlayerState(); ps.FPS = 1; ps.pos = Player.transform.position; for (int i = 0; i < 1000; i++) { GameConfig.StateFlow[i] = ps; } int index = 1; foreach (TeamController.Member m in TeamController.Team.Mem) { if (m.Name != "世原·安诺") { GameObject fab = (GameObject)Resources.Load("Prefabs\\Follower"); GameObject box = Instantiate(fab, new Vector3(0, 0, 0), Quaternion.identity); FollowerController fc = box.GetComponent <FollowerController>(); fc.character = m.Name; fc.DelayStep = 20 * index; fc.Confirm(); index++; box.SetActive(true); } } } //无论如何是否在目标地图,一旦已经加载地图,存档就不应该被二次还原 GameConfig.Loaded = true; }
protected override async void OnAppearing() { base.OnAppearing(); user = Application.Current.Properties[CommonSettings.GLOBAL_USER] as User; followerController = new FollowerController(); followingController = new FollowerController(); List <FollowViewModel> followers = await followerController.getAllFollowers(user.userId); lblFollowersCount.Text = followers.Count().ToString(); List <FollowViewModel> following = await followingController.getAllFollowing(user.userId); lblFollowingCount.Text = following.Count().ToString(); lblUsername.Text = user.username; lblname.Text = (user.firstName + " " + user.lastName); ProfilePicture profilePicture = await profilePictureController.getModel(user.userId); if (profilePicture != null) { if (profilePicture.profilePicture != " ") { string profilePicString = profilePicture.profilePicture; profilePic.Source = getImageSourceFromString(profilePicString); } } List <OutfitViewModel> outfitViewModels = await outfitController.getOutfits(user.userId); Image[] clothImageHolder = { pic1Shirt, pic1Pant, pic2Shirt, pic2Pant, pic3Shirt, pic3Pant, pic4Shirt, pic4Pant, pic5Shirt, pic5Pant, pic6Shirt, pic6Pant }; for (int i = 0; i < outfitViewModels.Count; i = i + 2) { string shirtString = outfitViewModels[i].clothPicString; string pantString = outfitViewModels[i + 1].clothPicString; clothImageHolder[i].Source = getImageSourceFromString(shirtString); clothImageHolder[i + 1].Source = getImageSourceFromString(pantString); } int outfitCount = outfitViewModels.Count() / 2; lblPostsCount.Text = outfitCount.ToString(); ; }
public async void Get_Not_Exists() { FollowerControllerMockFacade mock = new FollowerControllerMockFacade(); mock.ServiceMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ApiFollowerResponseModel>(null)); FollowerController controller = new FollowerController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); IActionResult response = await controller.Get(default(int)); response.Should().BeOfType <StatusCodeResult>(); (response as StatusCodeResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound); mock.ServiceMock.Verify(x => x.Get(It.IsAny <int>())); }
private void OnTriggerEnter(Collider c) { if (giveBirthTimer >= newPartnerCountdown && !findPartner && GameManager.Instance.CanBirth()) { if (c.gameObject.CompareTag("follower") && c.gameObject.GetComponent <FollowerController>().gender != gender) { partnerFollower = c.gameObject; partnerController = partnerFollower.GetComponent <FollowerController>(); partnerController.findPartner = true; findPartner = true; partnerController.partnerTransform = transform; partnerTransform = partnerController.partnerTransform; partnerController.SetBirth(false); SetBirth(true); } } }
public async void Delete_Errors() { FollowerControllerMockFacade mock = new FollowerControllerMockFacade(); var mockResult = new Mock <ActionResponse>(); mockResult.SetupGet(x => x.Success).Returns(false); mock.ServiceMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.FromResult <ActionResponse>(mockResult.Object)); FollowerController controller = new FollowerController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); IActionResult response = await controller.Delete(default(int)); response.Should().BeOfType <ObjectResult>(); (response as ObjectResult).StatusCode.Should().Be((int)HttpStatusCode.UnprocessableEntity); mock.ServiceMock.Verify(x => x.Delete(It.IsAny <int>())); }
public async void All_Not_Exists() { FollowerControllerMockFacade mock = new FollowerControllerMockFacade(); mock.ServiceMock.Setup(x => x.All(It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult <List <ApiFollowerResponseModel> >(new List <ApiFollowerResponseModel>())); FollowerController controller = new FollowerController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); IActionResult response = await controller.All(1000, 0); response.Should().BeOfType <OkObjectResult>(); (response as OkObjectResult).StatusCode.Should().Be((int)HttpStatusCode.OK); var items = (response as OkObjectResult).Value as List <ApiFollowerResponseModel>; items.Should().BeEmpty(); mock.ServiceMock.Verify(x => x.All(It.IsAny <int>(), It.IsAny <int>())); }
public async void Update_NotFound() { FollowerControllerMockFacade mock = new FollowerControllerMockFacade(); var mockResult = new Mock <UpdateResponse <ApiFollowerResponseModel> >(); mockResult.SetupGet(x => x.Success).Returns(false); mock.ServiceMock.Setup(x => x.Update(It.IsAny <int>(), It.IsAny <ApiFollowerRequestModel>())).Returns(Task.FromResult <UpdateResponse <ApiFollowerResponseModel> >(mockResult.Object)); mock.ServiceMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ApiFollowerResponseModel>(null)); FollowerController controller = new FollowerController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, new ApiFollowerModelMapper()); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); IActionResult response = await controller.Update(default(int), new ApiFollowerRequestModel()); response.Should().BeOfType <StatusCodeResult>(); (response as StatusCodeResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound); mock.ServiceMock.Verify(x => x.Get(It.IsAny <int>())); }
void changeAgentToFollower(GameObject ncrowd) { ncrowd.AddComponent <FollowerController>(); ncrowd.layer = LayerMask.NameToLayer("Follower"); //When there is only a capsule model ncrowd.GetComponent <MeshRenderer>().material = material[1]; FollowerController fc = ncrowd.GetComponent <FollowerController>(); //When there is a human model /* SkinnedMeshRenderer[] mesh = ncrowd.GetComponentsInChildren<SkinnedMeshRenderer>(); * foreach(SkinnedMeshRenderer m in mesh) * { * m.material.color = Color.yellow; * }*/ fc.material[0] = material[1]; fc.material[1] = material[2]; ncrowd.GetComponentInChildren <AreaOfInfluenceController>().setInfluence(fc.getInfluence()); totalFollowers++; }
void OnTriggerEnter2D(Collider2D col) { if (col.name == "Walls" || col.tag == "Door") { Destroy(gameObject); Instantiate(particles, transform.position, transform.rotation); } if (col.tag == "Enemy" && gameObject.tag == "friendlyBullet") { Destroy(gameObject); Instantiate(particles, transform.position, transform.rotation); EnemyController enemy = col.GetComponent <EnemyController>(); if (enemy != null) { enemy.Stun((float)0.5); enemy.Damage(bulletDamage); } } if (col.tag == "Follower" && gameObject.tag == "enemyBullet") { Destroy(gameObject); Instantiate(particles, transform.position, transform.rotation); FollowerController follower = col.GetComponent <FollowerController>(); if (follower != null) { follower.Damage(bulletDamage); } } if (col.tag == "Player" && gameObject.tag == "enemyBullet") { Destroy(gameObject); Instantiate(particles, transform.position, transform.rotation); PlayerController.instance.Damage(bulletDamage); GameObject.Find("playerHP").GetComponent <Text>().text = "HP: " + PlayerController.instance.getHealth().ToString() + "/" + PlayerController.instance.maxHealth.ToString(); } // restart = true; // timer = 0.0f; }
public async void Patch_Record_Not_Found() { FollowerControllerMockFacade mock = new FollowerControllerMockFacade(); var mockResult = new Mock <ActionResponse>(); mock.ServiceMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ApiFollowerResponseModel>(null)); FollowerController controller = new FollowerController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); var patch = new JsonPatchDocument <ApiFollowerRequestModel>(); patch.Replace(x => x.Blocked, "A"); IActionResult response = await controller.Patch(default(int), patch); response.Should().BeOfType <StatusCodeResult>(); (response as StatusCodeResult).StatusCode.Should().Be((int)HttpStatusCode.NotFound); mock.ServiceMock.Verify(x => x.Get(It.IsAny <int>())); }
public async void Create_No_Errors() { FollowerControllerMockFacade mock = new FollowerControllerMockFacade(); var mockResponse = ValidationResponseFactory <ApiFollowerServerResponseModel> .CreateResponse(null as ApiFollowerServerResponseModel); mockResponse.SetRecord(new ApiFollowerServerResponseModel()); mock.ServiceMock.Setup(x => x.Create(It.IsAny <ApiFollowerServerRequestModel>())).Returns(Task.FromResult <CreateResponse <ApiFollowerServerResponseModel> >(mockResponse)); FollowerController controller = new FollowerController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); IActionResult response = await controller.Create(new ApiFollowerServerRequestModel()); response.Should().BeOfType <CreatedResult>(); (response as CreatedResult).StatusCode.Should().Be((int)HttpStatusCode.Created); var createResponse = (response as CreatedResult).Value as CreateResponse <ApiFollowerServerResponseModel>; createResponse.Record.Should().NotBeNull(); mock.ServiceMock.Verify(x => x.Create(It.IsAny <ApiFollowerServerRequestModel>())); }
public async void BulkInsert_Errors() { FollowerControllerMockFacade mock = new FollowerControllerMockFacade(); var mockResponse = new Mock <CreateResponse <ApiFollowerServerResponseModel> >(null as ApiFollowerServerResponseModel); mockResponse.SetupGet(x => x.Success).Returns(false); mock.ServiceMock.Setup(x => x.Create(It.IsAny <ApiFollowerServerRequestModel>())).Returns(Task.FromResult <CreateResponse <ApiFollowerServerResponseModel> >(mockResponse.Object)); FollowerController controller = new FollowerController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); var records = new List <ApiFollowerServerRequestModel>(); records.Add(new ApiFollowerServerRequestModel()); IActionResult response = await controller.BulkInsert(records); response.Should().BeOfType <ObjectResult>(); (response as ObjectResult).StatusCode.Should().Be((int)HttpStatusCode.UnprocessableEntity); mock.ServiceMock.Verify(x => x.Create(It.IsAny <ApiFollowerServerRequestModel>())); }
public void doIt(GameObject gameObject) { Transform target = gameObject.transform; for (int i = 0; i < count; i++) { Vector3 newPos = transform.position - distance * (i + 1) * transform.forward; PlanetMovable pm = GameObject.Instantiate <PlanetMovable>(source, newPos, transform.rotation); pm.gameObject.name = "movable" + i; FactoryPlugin fg = factoryPloginSocket as FactoryPlugin; if (fg != null) { fg.doIt(pm.gameObject); } FollowerController fc = pm.gameObject.GetComponent <FollowerController>(); fc.followTarget = target; target = pm.transform; } }
public void Init() //initialize screen components { BackgroundColor = Constants.backgroundColor; userController = new UserController(); followerController = new FollowerController(); }
public void Register(FollowerController follower) { followers.Add(follower); }