public void CreateTest() { PlayerSpecialApiVM vm = _controller.CreateVM <PlayerSpecialApiVM>(); PlayerSpecial v = new PlayerSpecial(); v.Strength = 2; v.Perception = 43; v.Endurance = 28; v.Charisma = 38; v.Intelligence = 61; v.Agility = 24; v.Luck = 19; vm.Entity = v; var rv = _controller.Add(vm); Assert.IsInstanceOfType(rv, typeof(OkObjectResult)); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { var data = context.Set <PlayerSpecial>().FirstOrDefault(); Assert.AreEqual(data.Strength, 2); Assert.AreEqual(data.Perception, 43); Assert.AreEqual(data.Endurance, 28); Assert.AreEqual(data.Charisma, 38); Assert.AreEqual(data.Intelligence, 61); Assert.AreEqual(data.Agility, 24); Assert.AreEqual(data.Luck, 19); Assert.AreEqual(data.CreateBy, "user"); Assert.IsTrue(DateTime.Now.Subtract(data.CreateTime.Value).Seconds < 10); } }
public void EditTest() { PlayerSpecial v = new PlayerSpecial(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v.Strength = 70; v.Perception = 76; v.Endurance = 25; v.Charisma = 74; v.Intelligence = 72; v.Agility = 28; v.Luck = 51; context.Set <PlayerSpecial>().Add(v); context.SaveChanges(); } PartialViewResult rv = (PartialViewResult)_controller.Edit(v.ID.ToString()); Assert.IsInstanceOfType(rv.Model, typeof(PlayerSpecialVM)); PlayerSpecialVM vm = rv.Model as PlayerSpecialVM; v = new PlayerSpecial(); v.ID = vm.Entity.ID; v.Strength = 88; v.Perception = 62; v.Endurance = 44; v.Charisma = 64; v.Intelligence = 24; v.Agility = 89; v.Luck = 87; vm.Entity = v; vm.FC = new Dictionary <string, object>(); vm.FC.Add("Entity.Strength", ""); vm.FC.Add("Entity.Perception", ""); vm.FC.Add("Entity.Endurance", ""); vm.FC.Add("Entity.Charisma", ""); vm.FC.Add("Entity.Intelligence", ""); vm.FC.Add("Entity.Agility", ""); vm.FC.Add("Entity.Luck", ""); _controller.Edit(vm); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { var data = context.Set <PlayerSpecial>().FirstOrDefault(); Assert.AreEqual(data.Strength, 88); Assert.AreEqual(data.Perception, 62); Assert.AreEqual(data.Endurance, 44); Assert.AreEqual(data.Charisma, 64); Assert.AreEqual(data.Intelligence, 24); Assert.AreEqual(data.Agility, 89); Assert.AreEqual(data.Luck, 87); Assert.AreEqual(data.UpdateBy, "user"); Assert.IsTrue(DateTime.Now.Subtract(data.UpdateTime.Value).Seconds < 10); } }
public void DeleteTest() { PlayerSpecial v = new PlayerSpecial(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v.Strength = 70; v.Perception = 76; v.Endurance = 25; v.Charisma = 74; v.Intelligence = 72; v.Agility = 28; v.Luck = 51; context.Set <PlayerSpecial>().Add(v); context.SaveChanges(); } PartialViewResult rv = (PartialViewResult)_controller.Delete(v.ID.ToString()); Assert.IsInstanceOfType(rv.Model, typeof(PlayerSpecialVM)); PlayerSpecialVM vm = rv.Model as PlayerSpecialVM; v = new PlayerSpecial(); v.ID = vm.Entity.ID; vm.Entity = v; _controller.Delete(v.ID.ToString(), null); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { Assert.AreEqual(context.Set <PlayerSpecial>().Count(), 0); } }
public void CreateTest() { PartialViewResult rv = (PartialViewResult)_controller.Create(); Assert.IsInstanceOfType(rv.Model, typeof(PlayerSpecialVM)); PlayerSpecialVM vm = rv.Model as PlayerSpecialVM; PlayerSpecial v = new PlayerSpecial(); v.Strength = 70; v.Perception = 76; v.Endurance = 25; v.Charisma = 74; v.Intelligence = 72; v.Agility = 28; v.Luck = 51; vm.Entity = v; _controller.Create(vm); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { var data = context.Set <PlayerSpecial>().FirstOrDefault(); Assert.AreEqual(data.Strength, 70); Assert.AreEqual(data.Perception, 76); Assert.AreEqual(data.Endurance, 25); Assert.AreEqual(data.Charisma, 74); Assert.AreEqual(data.Intelligence, 72); Assert.AreEqual(data.Agility, 28); Assert.AreEqual(data.Luck, 51); Assert.AreEqual(data.CreateBy, "user"); Assert.IsTrue(DateTime.Now.Subtract(data.CreateTime.Value).Seconds < 10); } }
public void EditTest() { PlayerSpecial v = new PlayerSpecial(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v.Strength = 2; v.Perception = 43; v.Endurance = 28; v.Charisma = 38; v.Intelligence = 61; v.Agility = 24; v.Luck = 19; context.Set <PlayerSpecial>().Add(v); context.SaveChanges(); } PlayerSpecialApiVM vm = _controller.CreateVM <PlayerSpecialApiVM>(); var oldID = v.ID; v = new PlayerSpecial(); v.ID = oldID; v.Strength = 51; v.Perception = 7; v.Endurance = 80; v.Charisma = 69; v.Intelligence = 54; v.Agility = 88; v.Luck = 27; vm.Entity = v; vm.FC = new Dictionary <string, object>(); vm.FC.Add("Entity.Strength", ""); vm.FC.Add("Entity.Perception", ""); vm.FC.Add("Entity.Endurance", ""); vm.FC.Add("Entity.Charisma", ""); vm.FC.Add("Entity.Intelligence", ""); vm.FC.Add("Entity.Agility", ""); vm.FC.Add("Entity.Luck", ""); var rv = _controller.Edit(vm); Assert.IsInstanceOfType(rv, typeof(OkObjectResult)); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { var data = context.Set <PlayerSpecial>().FirstOrDefault(); Assert.AreEqual(data.Strength, 51); Assert.AreEqual(data.Perception, 7); Assert.AreEqual(data.Endurance, 80); Assert.AreEqual(data.Charisma, 69); Assert.AreEqual(data.Intelligence, 54); Assert.AreEqual(data.Agility, 88); Assert.AreEqual(data.Luck, 27); Assert.AreEqual(data.UpdateBy, "user"); Assert.IsTrue(DateTime.Now.Subtract(data.UpdateTime.Value).Seconds < 10); } }
private void SpawnNewPlayer(Vector3 position, Quaternion rotation) { var player = Instantiate(playerPrefab, position, rotation) as GameObject; player.GetComponent <PlayerLife>().MakeInvincible(invincibleTime); referenceFrame.player = player; playerSpecial = player.GetComponentInChildren <PlayerSpecial>(); }
void Start() { DOTween.SetTweensCapacity(600, 600); gameStates = GameStates.Start; playerDir = PlayerDir.Straight; playerSpecial = playerObj.GetComponent <PlayerSpecial>(); playerRb = playerObj.GetComponent <Rigidbody>(); camHolder.GetComponent <CameraFollow>().enabled = true; UIManager.Instance.distanceChecker.gameObject.SetActive(true); }
public void Start() { currentLives = startingLives; bgManager = FindObjectOfType <BackgroundManager>(); scoreController = FindObjectOfType <ScoreController>(); showHighScoreBox = false; timeCounter = 0; transition = UITransitionState.Steady; playerSpecial = FindObjectOfType <PlayerSpecial>(); referenceFrame = FindObjectOfType <ReferenceFrame>(); }
// Use this for initialization void Start() { enemy = enemy.GetComponent <Animator>(); choicePanel = GameObject.Find("Choice Panel"); playerMovement = GameObject.Find("Player").GetComponent <PlayerMovement> (); playerAttacking = GameObject.Find("PlayerAttack").GetComponent <PlayerAttacking> (); playerSpecial = GameObject.Find("PlayerSpecial").GetComponent <PlayerSpecial> (); playerItem = GameObject.Find("Player").GetComponent <PlayerItem> (); playerMovement.enabled = false; playerAttacking.enabled = false; phase = battlePhase.Choice; // Debug.Log ("Current Phase: " + phase); }
/// <summary> /// 初始化角色七维 /// </summary> /// <returns></returns> public PlayerSpecial InitPlayerSpecial() { PlayerSpecial ps = new PlayerSpecial { Strength = RandMethod.GetRandNumber(), Perception = RandMethod.GetRandNumber(), Endurance = RandMethod.GetRandNumber(), Charisma = RandMethod.GetRandNumber(), Intelligence = RandMethod.GetRandNumber(), Agility = RandMethod.GetRandNumber(), Luck = RandMethod.GetRandNumber() }; return(ps); }
public void GetTest() { PlayerSpecial v = new PlayerSpecial(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v.Strength = 2; v.Perception = 43; v.Endurance = 28; v.Charisma = 38; v.Intelligence = 61; v.Agility = 24; v.Luck = 19; context.Set <PlayerSpecial>().Add(v); context.SaveChanges(); } var rv = _controller.Get(v.ID.ToString()); Assert.IsNotNull(rv); }
public void DetailsTest() { PlayerSpecial v = new PlayerSpecial(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v.Strength = 70; v.Perception = 76; v.Endurance = 25; v.Charisma = 74; v.Intelligence = 72; v.Agility = 28; v.Luck = 51; context.Set <PlayerSpecial>().Add(v); context.SaveChanges(); } PartialViewResult rv = (PartialViewResult)_controller.Details(v.ID.ToString()); Assert.IsInstanceOfType(rv.Model, typeof(IBaseCRUDVM <TopBasePoco>)); Assert.AreEqual(v.ID, (rv.Model as IBaseCRUDVM <TopBasePoco>).Entity.GetID()); }
public void BatchDeleteTest() { PlayerSpecial v1 = new PlayerSpecial(); PlayerSpecial v2 = new PlayerSpecial(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v1.Strength = 70; v1.Perception = 76; v1.Endurance = 25; v1.Charisma = 74; v1.Intelligence = 72; v1.Agility = 28; v1.Luck = 51; v2.Strength = 88; v2.Perception = 62; v2.Endurance = 44; v2.Charisma = 64; v2.Intelligence = 24; v2.Agility = 89; v2.Luck = 87; context.Set <PlayerSpecial>().Add(v1); context.Set <PlayerSpecial>().Add(v2); context.SaveChanges(); } PartialViewResult rv = (PartialViewResult)_controller.BatchDelete(new string[] { v1.ID.ToString(), v2.ID.ToString() }); Assert.IsInstanceOfType(rv.Model, typeof(PlayerSpecialBatchVM)); PlayerSpecialBatchVM vm = rv.Model as PlayerSpecialBatchVM; vm.Ids = new string[] { v1.ID.ToString(), v2.ID.ToString() }; _controller.DoBatchDelete(vm, null); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { Assert.AreEqual(context.Set <PlayerSpecial>().Count(), 0); } }
public void BatchDeleteTest() { PlayerSpecial v1 = new PlayerSpecial(); PlayerSpecial v2 = new PlayerSpecial(); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { v1.Strength = 2; v1.Perception = 43; v1.Endurance = 28; v1.Charisma = 38; v1.Intelligence = 61; v1.Agility = 24; v1.Luck = 19; v2.Strength = 51; v2.Perception = 7; v2.Endurance = 80; v2.Charisma = 69; v2.Intelligence = 54; v2.Agility = 88; v2.Luck = 27; context.Set <PlayerSpecial>().Add(v1); context.Set <PlayerSpecial>().Add(v2); context.SaveChanges(); } var rv = _controller.BatchDelete(new string[] { v1.ID.ToString(), v2.ID.ToString() }); Assert.IsInstanceOfType(rv, typeof(OkObjectResult)); using (var context = new DataContext(_seed, DBTypeEnum.Memory)) { Assert.AreEqual(context.Set <PlayerSpecial>().Count(), 0); } rv = _controller.BatchDelete(new string[] {}); Assert.IsInstanceOfType(rv, typeof(OkResult)); }
public void Start() { currentLives = startingLives; bgManager = FindObjectOfType<BackgroundManager>(); scoreController = FindObjectOfType<ScoreController>(); showHighScoreBox = false; timeCounter = 0; transition = UITransitionState.Steady; playerSpecial = FindObjectOfType<PlayerSpecial>(); referenceFrame = FindObjectOfType<ReferenceFrame>(); }
/// <summary> /// Plays a single playerspecial sound effect. /// </summary> public static void NewPlayerSpecial() { PlayerSpecial.Play(); }
// Use this for initialization void Start() { playerSpecial = GameObject.Find("PlayerSpecial").GetComponent <PlayerSpecial> (); gameControl = GameObject.Find("GameControl").GetComponent <TurnBasedBattle> (); }
void Start() { script = this; }
private void SpawnNewPlayer(Vector3 position, Quaternion rotation) { var player = Instantiate(playerPrefab, position, rotation) as GameObject; player.GetComponent<PlayerLife>().MakeInvincible(invincibleTime); referenceFrame.player = player; playerSpecial = player.GetComponentInChildren<PlayerSpecial>(); }