public List <Prone> GetByUserId(int id) { List <Prone> list = new List <Prone>(); using (SqlConnection con = new SqlConnection(Connection.String())) { using (SqlCommand cmd = new SqlCommand("sp_GetPropertiesByUserId", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@id", SqlDbType.Int).Value = id; con.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { ProneComponent newProneComp = new ProneComponent(Convert.ToInt32(reader[0]), reader[1].ToString(), Convert.ToDouble(reader[2]), Convert.ToInt32(reader[3]), Convert.ToInt32(reader[4]), Convert.ToDouble(reader["pricePerMonth"]), 0, Convert.ToString(reader["pronePicturePath"])); ProneInfo pInfo = new ProneInfo(Convert.ToDouble(reader[9])); Prone newProne = new Prone(newProneComp, pInfo); list.Add(newProne); } } } } } return(list); }
public List <Prone> SearchByCity(Search search) { List <Prone> list = new List <Prone>(); using (SqlConnection con = new SqlConnection(Connection.String())) { using (SqlCommand cmd = new SqlCommand("sp_SearchHouseByCity", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@city", SqlDbType.VarChar).Value = search.Qyteti; con.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { ProneComponent newProneComp = new ProneComponent(Convert.ToInt32(reader[0]), reader[1].ToString(), Convert.ToDouble(reader[2]), Convert.ToInt32(reader[3]), Convert.ToInt32(reader[4]), Convert.ToDouble(reader["pricePerMonth"]), 0, Convert.ToString(reader["pronePicturePath"])); ProneInfo pInfo = new ProneInfo(Convert.ToDouble(reader[9])); Prone newProne = new Prone(newProneComp, pInfo); list.Add(newProne); } } } } } return(list); }
private void Awake() { walk = new Walk(this.gameObject); run = new Run(this.gameObject); crouch = new Crouch(this.gameObject); prone = new Prone(this.gameObject); }
public void Apply_NotACharacter_Test() { var entity = Mock.Of <IEntity>(); var prone = new Prone(); prone.Apply(entity); Assert.IsTrue(true); // If we made it here without exception then the test passed }
public void Remove_NoConditions_Test() { var character = CreateMockCharacter(); var prone = new Prone(); prone.Apply(character); prone.Remove(character); Assert.AreEqual(0, character.Conditions.Count); }
public void Apply_Character_WithExistingProneCondition_Test() { var character = CreateMockCharacter(); character.Conditions.Add(new Prone()); var prone = new Prone(); prone.Apply(character); }
public void Apply_Character_NoConditions_Test() { var character = CreateMockCharacter(); var prone = new Prone(); prone.Apply(character); Assert.AreEqual(EntityIds.PRONE_CONDITION_ID, character.Conditions[0].Id); Assert.IsTrue(character.Conditions.Any(c => c.Id == EntityIds.PRONE_CONDITION_ID)); Assert.IsTrue(character.Conditions.Any(c => c.Id == EntityIds.FLAT_FOOTED_CONDITION_ID)); }
public void Apply_Character_FlatFootedToAllExists_Test() { var character = CreateMockCharacter(); var flatFooted = new FlatFooted(FlatFooted.AllCharacters); var prone = new Prone(); prone.Apply(character); var savedFlatFooted = (FlatFooted)character.Conditions.FirstOrDefault(c => c.Id == EntityIds.FLAT_FOOTED_CONDITION_ID); Assert.AreSame(flatFooted, savedFlatFooted); }
public virtual void Process() { if (Crouch.Process()) { } else if (Prone.Process()) { } else if (Sprint.Process()) { } }
public void Remove_WithExistingFlatFootedToOne_Test() { var character = CreateMockCharacter(); var flatFooted = new FlatFooted(1); flatFooted.Apply(character); var prone = new Prone(); prone.Apply(character); prone.Remove(character); Assert.AreEqual(0, character.Conditions.Count); }
public void Apply_Character_FlatFootedToOneExists_Test() { var character = CreateMockCharacter(); var flatFooted = new FlatFooted(1); var prone = new Prone(); prone.Apply(character); var savedFlatFooted = (FlatFooted)character.Conditions.FirstOrDefault(c => c.Id == EntityIds.FLAT_FOOTED_CONDITION_ID); Assert.IsTrue(savedFlatFooted.FlatFootedFrom.Contains(FlatFooted.AllCharacters)); Assert.IsFalse(savedFlatFooted.FlatFootedFrom.Contains(1)); }
public void Remove_WithExistingFlatFootedToAll_Test() { var character = CreateMockCharacter(); var flatFooted = new FlatFooted(FlatFooted.AllCharacters); flatFooted.Apply(character); var prone = new Prone(); prone.Apply(character); prone.Remove(character); Assert.AreEqual(1, character.Conditions.Count); Assert.AreSame(flatFooted, character.Conditions[0]); }
public string[] ToArray() { string[] array = new string[16]; array[0] = Blinded.Equals("Cured") ? "" : "Blinded"; array[1] = Charmed.Equals("Cured") ? "" : "Charmed"; array[2] = Deafened.Equals("Cured") ? "" : "Deafened"; array[3] = Encumbrance.Equals("Normal") ? "" : Encumbrance; array[4] = Fatigued.Equals("Cured") ? "" : Fatigued; array[5] = Frightened.Equals("Cured") ? "" : "Frightened"; array[6] = Grappled.Equals("Cured") ? "" : "Grappled"; array[7] = Incapacitated.Equals("Cured") ? "" : "Incapacitated"; array[8] = Invisible.Equals("Cured") ? "" : "Invisible"; array[9] = Paralyzed.Equals("Cured") ? "" : "Paralyzed"; array[10] = Petrified.Equals("Cured") ? "" : "Petrified"; array[11] = Poisoned.Equals("Cured") ? "" : "Poisoned"; array[12] = Prone.Equals("Cured") ? "" : "Prone"; array[13] = Restrained.Equals("Cured") ? "" : "Restrained"; array[14] = Stunned.Equals("Cured") ? "" : "Stunned"; array[15] = Unconscious.Equals("Cured") ? "" : "Unconscious"; return(array); }
protected void Awake() { anim = GetComponent <Animator>(); Shaker = GameObject.FindGameObjectWithTag("Shake"); maxGrip = fighter.weight; HP = fighter.HitPoints; jumpHeight = fighter.jumpHeight; moveSpeed = fighter.speed; maxJumpCount = fighter.jumpCount; rigidBody = GetComponent <Rigidbody2D>(); Target = GameObject.FindGameObjectWithTag("Floor").GetComponent <GravAttractor>(); Shield = GetComponentInChildren <Barrier>(true).gameObject; if (isPlayer) { player = ReInput.players.GetPlayer(playerID); //The player controlling this fighter } gameObject.name = fighter.name.ToString() + playerID; statemachine = new StateMachine(); var flinch = new Flinch(this); var walk = new Walk(this); var run = new Run(this); var idle = new Idle(this); var jump = new Jump(this); var groundattack = new GroundAttack(this, attack); var airattack = new AirAttack(this, attack); var stun = new Stun(this); var leapprep = new LeapPrep(this); var blocking = new Blocking(this); var dodge = new AirDodge(this); var leap = new Leaping(this); var prone = new Prone(this); At(dodge, idle, landed()); At(flinch, idle, stunless()); At(run, idle, stop()); At(walk, idle, stop()); At(idle, jump, jumping()); At(idle, jump, unground()); At(jump, jump, jumping()); At(walk, jump, unground()); At(run, jump, unground()); At(walk, jump, jumping()); At(run, jump, jumping()); At(walk, run, running()); At(run, walk, walking()); At(idle, walk, walking()); At(idle, run, running()); At(idle, groundattack, offensive()); At(walk, groundattack, offensive()); At(run, groundattack, offensive()); At(jump, airattack, offensive()); At(groundattack, idle, unoffensive()); At(airattack, jump, unoffensive()); At(airattack, idle, landed()); At(jump, airattack, offensive()); At(jump, idle, landed()); At(jump, dodge, guard()); At(blocking, stun, pierce()); At(idle, blocking, guard()); At(walk, blocking, guard()); At(run, blocking, guard()); At(leapprep, idle, cancelleap()); At(leapprep, leap, gravityChange()); At(blocking, idle, unguard()); At(leap, idle, landed()); At(prone, idle, stunless()); statemachine.AddAnyTransition(leapprep, () => LeapPrep && leapCooldown <= 0); statemachine.AddAnyTransition(stun, () => stunned); statemachine.AddAnyTransition(flinch, () => isDamaged); statemachine.AddAnyTransition(prone, () => slam); Func <bool> stunless() => () => doneStun == true; Func <bool> walking() => () => speed > 0.3 && speed < 0.7; Func <bool> running() => () => speed > 0.7; Func <bool> stop() => () => speed < 0.3; Func <bool> jumping() => () => (jumpTimer > Time.time) && (maxJumpCount > jumpCount) && !action && actionCooldown > 0; Func <bool> offensive() => () => attack != null && actionCooldown > 0; Func <bool> unoffensive() => () => attack == null; Func <bool> landed() => () => grounded; Func <bool> pierce() => () => Guard <= 0; Func <bool> guard() => () => isBlocking && actionCooldown > 0; Func <bool> unguard() => () => !isBlocking; Func <bool> gravityChange() => () => LeapRelease; Func <bool> cancelleap() => () => cancelled; Func <bool> unground() => () => !grounded; statemachine.SetState(idle); }