// Use this for initialization void Start() { weapon = gameObject.GetComponent <CharacterWeapon>(); FirstFire = false; SecondFire = false; ThirdFire = false; FourthFire = false; FifthFire = false; //LastFire = false; FirstWater = false; SecondWater = false; ThirdWater = false; FourthWater = false; FifthWater = false; FirstEarth = false; SecondEarth = false; ThirdEarth = false; FourthEarth = false; FifthEarth = false; FirstLightning = false; SecondLightning = false; ThirdLightning = false; FourthLightning = false; FifthLightning = false; }
public void ResetControl() { _intCharacterID = 0; _intWeaponID = 0; _OriginalCharWeaponID = 0; _cwObjCW = new CharacterWeapon(); }
public void Test3SetPowerRange(int lvl, int power, Type ex = null) { UserElementDto dElement = new UserElementDto() { Id = Guid.NewGuid().ToString(), Lvl = lvl, }; var config = new MapperConfiguration(c => { c.CreateMap <CharacterWeapon, UserElementDto>().ReverseMap(); }); config.AssertConfigurationIsValid(); IMapper mapper = config.CreateMapper(); try { CharacterWeapon uElement = mapper.Map <CharacterWeapon>(dElement); uElement.setPowerLvl(); Assert.That(power, Is.EqualTo(uElement.PowerLvl)); }catch (Exception e) { Assert.That(e, Is.TypeOf(ex)); } }
public void Shoot() { GameObject bull = Instantiate(characterWeapon, bulletSpawn.position, bulletSpawn.rotation); CharacterWeapon weapon = bull.GetComponent<CharacterWeapon>(); var dir = Input.mousePosition; weapon.dir = dir; }
protected virtual void Start() { controller = GetComponent <CharacterControls>(); character = GetComponent <Character>(); characterWeapon = GetComponent <CharacterWeapon>(); characterMovement = GetComponent <CharacterMovement>(); animator = GetComponent <Animator>(); }
private void Awake() { _characterControler = new CharacterController(); _characterControler.SetCharacterModel(this, _character = GetComponent <CharacterView>()); _characterWeapon = GetComponent <CharacterWeapon>(); rb = GetComponent <Rigidbody2D>(); transfom = GetComponent <Transform>(); _spriteRenderer = GetComponent <SpriteRenderer>(); }
void OnItemGrabbed(Character character) { CharacterWeapon characterWeapon = character.GetComponent <CharacterWeapon>(); if (characterWeapon != null) { characterWeapon.RemoveSecondaryWeapon(); characterWeapon.AddSecondaryWeapon(weaponPrefab); } }
public async Task <ActionResult> DeleteCharacter(string teamId, string characterId) { Team team = await _unitOfWork.TeamRepository.GetById(teamId); CharacterWeapon characterWeapon = team.CharacterWeapons.FirstOrDefault(c => c.Id == characterId); team.CharacterWeapons.Remove(characterWeapon); await _unitOfWork.SaveChangesAsync(); return(Ok(characterWeapon)); }
/// <summary> /// Create a new instance of CharacterLeftSide. /// </summary> /// <param name="weapon">The weapon equipped by the character.</param> /// <param name="head">The head equipment equipped by the character.</param> /// <param name="chest">The chest equipment equipped by the character.</param> /// <param name="arms">The arm equipment equipped by the character.</param> /// <param name="waist">The waist equipment equipped by the character.</param> /// <param name="legs">The leg equipment equipped by the character.</param> /// <param name="feet">The foot equipment equipped by the character.</param> public CharacterLeftSide(CharacterWeapon weapon, CharacterGear head, CharacterGear chest, CharacterGear arms, CharacterGear waist, CharacterGear legs, CharacterGear feet) { Weapon = weapon; Head = head; Chest = chest; Arms = arms; Waist = waist; Legs = legs; Feet = feet; }
private void SetAttackAndDamageBonusesVisibility(CharacterWeapon objCW) { //If the Range has Melee Data in it display Melee Data if (!Range.RangeTypeInRangeList("Melee", objCW.objWeapon.objRanges)) { BlankMeleeFields(); } //if the Range has Ranged Data in it display the Range Data if (!Range.RangeTypeInRangeList("Short", objCW.objWeapon.objRanges)) { BlankRangeFields(); } }
static public void storeWeapon <W>(W iWeapon, int i) where W : IWeapon { CharacterWeapon inventoryWeapon = new CharacterWeapon(); inventoryWeapon.Name = iWeapon.Name; inventoryWeapon.Damage = iWeapon.Damage; inventoryWeapon.CriticalRating = iWeapon.CriticalRating; inventoryWeapon.CriticalChance = iWeapon.CriticalChance; inventoryWeapon.Deflect = iWeapon.Deflect; inventoryWeapon.Value = iWeapon.Value; inventoryWeapon.Weight = iWeapon.Weight; weaponsArray[i] = inventoryWeapon; }
void Start() { _camera = GetComponentInChildren <Camera>(); _characterWeapon = GetComponent <CharacterWeapon>(); SenXConst = SensitivityX; SenYConst = SensitivityY; if (!isLocalPlayer) { _camera.enabled = false; _camera.GetComponentInChildren <Canvas>().enabled = false; } }
//public static bool firstFire; // Use this for initialization void Start() { inventory = gameObject.GetComponent <CharacterInventory>(); weapon = gameObject.GetComponent <CharacterWeapon>(); enhance = gameObject.GetComponent <WeaponEnhancements>(); inBattle = false; startHealth = 20.0f; health = startHealth; lifeFragments = 0; extraLives = 0; positionOfInBattle = 30.0f; //firstFire = false; }
void Start() { if (!isLocalPlayer) { return; } _inventoryMenu = GetComponentInChildren <PiUI>(); _characterMovement = GetComponent <CharacterMovement>(); _characterWeapon = GetComponent <CharacterWeapon>(); _cameraController = GetComponent <CameraController>(); SetItem(1); _inventoryMenu.dynamicallyScaleToResolution = true; }
public async Task <ActionResult> GetMaterials(CharacterWeapon characterWeapon) { ICollection <Material> cMaterials = characterWeapon.Character.TalentMaterials; ICollection <Material> wMaterials = characterWeapon.Weapon.Materials; AscensionCategory ascensionCategory = await _unitOfWork.AscensionCategoryRepository.GetByLvl(characterWeapon.PowerLvl); IEnumerable <Material> characterMaterials = cMaterials.Where(m => m.AscensionCategories.Contains(ascensionCategory)); IEnumerable <Material> weaponMaterials = wMaterials.Where(m => m.AscensionCategories.Contains(ascensionCategory)); MaterialsDto materialsDto = new MaterialsDto() { CharacterMaterials = characterMaterials, WeaponMaterials = weaponMaterials }; return(Ok(materialsDto)); }
/// <summary> /// Create a new instance of CharacterInventory. /// </summary> /// <param name="weapon">The weapon equipped by the character.</param> /// <param name="head">The head equipment equipped by the character.</param> /// <param name="chest">The chest equipment equipped by the character.</param> /// <param name="arms">The arm equipment equipped by the character.</param> /// <param name="waist">The waist equipment equipped by the character.</param> /// <param name="legs">The leg equipment equipped by the character.</param> /// <param name="feet">The foot equipment equipped by the character.</param> /// <param name="offhand">The offhand equipment equipped by the character.</param> /// <param name="earrings">The earring equipment equipped by the character.</param> /// <param name="necklace">The necklace equipment equipped by the character.</param> /// <param name="bracelet">The bracelet equipment equipped by the character.</param> /// <param name="ring1">The first ring equipment equipped by the character.</param> /// <param name="ring2">The second ring equipment equipped by the character.</param> public CharacterInventory(CharacterWeapon weapon, CharacterGear head, CharacterGear chest, CharacterGear arms, CharacterGear waist, CharacterGear legs, CharacterGear feet, CharacterGear offhand, CharacterGear earrings, CharacterGear necklace, CharacterGear bracelet, CharacterGear ring1, CharacterGear ring2) { Weapon = weapon; Head = head; Chest = chest; Arms = arms; Waist = waist; Legs = legs; Feet = feet; Offhand = offhand; Earrings = earrings; Necklace = necklace; Bracelet = bracelet; Ring1 = ring1; Ring2 = ring2; }
public Form1() { int intCharID = 1; Character objChar = new Character(intCharID); InitializeComponent(); CharacterWeapon objCharWeap = new CharacterWeapon(intCharID, 1); cwc1.SetControlWithCharacterWeapon(objChar, objCharWeap); //cwc1.CharacterID = objCharWeap.CharacterID; //cwc1.WeaponID = objCharWeap.WeaponID; //cwc1.WeaponName = objCharWeap.objWeapon.WeaponName; //cwc1.StunDamage = objCharWeap.objWeapon.StunDamage; //cwc1.Damage = objCharWeap.objWeapon.Damage; //cwc1.CharacterWeaponNotes = objCharWeap.Notes; ////cwc1.WeaponNotes = objCharWeap.objWeapon.Notes; //cwc1.Weight = objCharWeap.objWeapon.Weight; //cwc1.BookName = objCharWeap.objWeapon.objBook.BookName; //cwc1.SetRanges(objCharWeap.lstWeaponRanges); //cwc2.CharacterID = objCharWeap.CharacterID; //cwc2.WeaponID = objCharWeap.WeaponID; //cwc2.WeaponName = objCharWeap.objWeapon.WeaponName; //cwc2.StunDamage = objCharWeap.objWeapon.StunDamage; //cwc2.Damage = objCharWeap.objWeapon.Damage; //cwc2.CharacterWeaponNotes = objCharWeap.Notes; ////cwc2.WeaponNotes = objCharWeap.objWeapon.Notes; //cwc2.Weight = objCharWeap.objWeapon.Weight; //cwc2.BookName = objCharWeap.objWeapon.objBook.BookName; //Melee range Range objRange = new Range(1); List <Range> lstRanges = new List <Range>(); lstRanges.Add(objRange); objCharWeap.objWeapon.objRanges = lstRanges; //cwc2.SetRanges(lstRanges); cwc2.SetControlWithCharacterWeapon(objChar, objCharWeap); }
void Start() { if (!isLocalPlayer) { return; } _open = false; _cameraController = GetComponent <CameraController>(); _characterMovement = GetComponent <CharacterMovement>(); _characterWeapon = GetComponent <CharacterWeapon>(); _Weapon1Images = Weapon1.GetComponentsInChildren <Image>(); _Weapon2Images = Weapon2.GetComponentsInChildren <Image>(); _preTime = Time.time; Init(); }
public async Task <ActionResult> UpdateLevels(string userId, string teamId, string characterWeaponId, int charLvl, int weaponLvl) { User user = await _unitOfWork.UserRepository.GetById(userId); CharacterWeapon characterWeapon = user.Teams.FirstOrDefault(c => c.Id == teamId) .CharacterWeapons.FirstOrDefault(cw => cw.Id == characterWeaponId); foreach (Team team in user.Teams) { foreach (CharacterWeapon actualCW in team.CharacterWeapons) { if (actualCW.Character == characterWeapon.Character) { actualCW.setPowerLvl(charLvl); actualCW.setWeaponPower(weaponLvl); } } } await _unitOfWork.SaveChangesAsync(); return(Ok(characterWeapon)); }
public async Task <ActionResult> AddCharacter(string teamId, string characterId, string weaponId, int charLvl, int weaponLvl) { Team team = await _unitOfWork.TeamRepository.GetById(teamId); Character character = await _unitOfWork.CharacterRepository.GetById(characterId); Weapon weapon = await _unitOfWork.WeaponRepository.GetById(weaponId); CharacterWeapon characterWeapon = new CharacterWeapon(charLvl) { Character = character, Weapon = weapon }; characterWeapon.setWeaponPower(weaponLvl); if (team.AddCharacter(characterWeapon)) { await _unitOfWork.SaveChangesAsync(); return(Ok(team)); } return(BadRequest("The maximum Characters per Team is 5.")); }
// Update is called once per frame void Update() { float ammoRate = 0f; CharacterWeapon weapon = GameManager.player.getWeapon(); if (weapon.getClipLoadMax() >= 0) { ammoRate = (float)(weapon.getClipLoad()) / weapon.getClipLoadMax(); ammoRate = Mathf.Clamp(ammoRate, 0f, 1f); if (weapon.getStatus() == CharacterWeapon.Status.Idle) { filler.color = new Color(1f, 1f, 0.3f); fillerText.text = weapon.getClipLoad().ToString() + "/" + weapon.getCarry().ToString(); } if (weapon.getStatus() == CharacterWeapon.Status.Firing) { filler.color = new Color(1f, 0.5f, 0.3f); fillerText.text = weapon.getClipLoad().ToString() + "/" + weapon.getCarry().ToString(); } if (weapon.getStatus() == CharacterWeapon.Status.Reloading) { filler.color = new Color(1f, 0.5f, 0.3f); fillerText.text = "Reloading"; } } fillerMask.rectTransform.localScale = new Vector3(ammoRate, 1f, 1f); if (ammoRate > 0f) { filler.rectTransform.localScale = new Vector3(1f / ammoRate, 1f, 1f); } else { filler.rectTransform.localScale = new Vector3(1f, 1f, 1f); } }
public async Task <ActionResult> AddTeam(string userId, ICollection <CharacterDto> characters) { if (characters.Count == 0) { return(BadRequest("The team must contain at least one character.")); } Team team = new Team(); foreach (CharacterDto characterDto in characters) { Character character = _mapper.Map <Character>(characterDto); CharacterWeapon characterWeapon = new CharacterWeapon(0) { Character = character }; team.AddCharacter(characterWeapon); } User user = await _unitOfWork.UserRepository.GetById(userId); user.Teams.Add(team); await _unitOfWork.SaveChangesAsync(); return(Ok(characters)); }
public static List <CharacterWeapon> RetrieveWeaponsByCharacterID(int PlayerCharacterID) { List <CharacterWeapon> characterWeapons = new List <CharacterWeapon>(); // connection var conn = DBConnection.GetDBConnection(); // cmdtext var cmdText = @"sp_retrieve_weapons_by_playercharacterid"; // command var cmd = new SqlCommand(cmdText, conn); // command type cmd.CommandType = CommandType.StoredProcedure; // parameters cmd.Parameters.Add("@PlayerCharacterID", SqlDbType.Int); // parameter values cmd.Parameters["@PlayerCharacterID"].Value = PlayerCharacterID; // all set? need a try-catch try { // open a connection conn.Open(); // execute the command var reader = cmd.ExecuteReader(); // check for results if (reader.HasRows) { // multiple rows are possible, so use a while loop while (reader.Read()) { // create a character object var characterWeapon = new CharacterWeapon() { WeaponID = reader.GetInt32(0), Name = reader.GetString(1), Description = reader.GetString(2), Attack = reader.GetInt32(3), Quantity = reader.GetInt32(4) }; // add character to the list characterWeapons.Add(characterWeapon); } } } catch (Exception) { throw; } finally { conn.Close(); } return(characterWeapons); }
private void RemoveModsFromDevice() { CharacterEquipment objCharEquip = new CharacterEquipment(); CharacterArmor objCharArmor = new CharacterArmor(); CharacterWeapon objCharWeapon = new CharacterWeapon();; switch (enumModType) { case Common.ModificationType.Armor: objCharArmor.GetCharacterArmor(intModedObjID); break; case Common.ModificationType.Equipment: objCharEquip.GetCharacterEquipment(intModedObjID); break; case Common.ModificationType.Weapon: objCharWeapon.GetCharacterWeapon(intModedObjID); break; } //Delete the mod if its not in the selected list foreach (Modification objOrigMod in lstOriginalModfications) { if (!Modification.IsModificationInList(objOrigMod, lstModficationsSelected)) { switch (enumModType) { case Common.ModificationType.Armor: objCharArmor.DeleteCharacterArmorModification(intModedObjID, objOrigMod.ModificationID); break; case Common.ModificationType.Equipment: objCharEquip.DeleteCharacterEquipmentModification(intModedObjID, objOrigMod.ModificationID); break; case Common.ModificationType.Weapon: objCharWeapon.DeleteCharacterWeaponModification(intModedObjID, objOrigMod.ModificationID); break; } } } //Add the mod if its not in the Original List foreach (Modification objSelMod in lstModficationsSelected) { if (!Modification.IsModificationInList(objSelMod, lstOriginalModfications)) { switch (enumModType) { case Common.ModificationType.Armor: objSelMod.SaveCharacterArmorModification(objCharArmor.CharacterArmorID, objSelMod.ModificationID); break; case Common.ModificationType.Equipment: objSelMod.SaveCharacterEquipmentModification(objCharEquip.CharacterEquipmentID, objSelMod.ModificationID); break; case Common.ModificationType.Weapon: objSelMod.SaveCharacterWeaponModification(objCharWeapon.CharacterWeaponID, objSelMod.ModificationID); break; } } } }
private void Start() { _Instance = this; pool = new ObjectPool <BulletRed>(BulletFactory, BulletRed.TurnOn, BulletRed.TurnOff, 30, true); }
/// <summary> /// Create a NonPlayableCharacter with the specified health, ammo, and weapon objects, plus the given name /// </summary> /// <param name="health">CharacterStatusElement for health</param> /// <param name="ammo">CharacterStatusElement for ammo</param> /// <param name="weapon">CharacterStatusElement for the current weapon</param> /// <param name="name">The character's name</param> /// <param name="detector">Collision detector with which the object should register.</param> public NonPlayableCharacterAbstract(CharacterHealth health, CharacterAmmo ammo, CharacterWeapon weapon, string name, CollisionDetectorInterface detector) : base(health, ammo, weapon, name, detector) { }
public void Test1PowerSettedByLvl(int lvl, int power) { CharacterWeapon uElement = new CharacterWeapon(lvl); Assert.That(power, Is.EqualTo(uElement.PowerLvl)); }
/// <summary> /// Create a NonPlayableCharacter with the specified health, ammo, and weapon objects, plus the given name. /// Also, specify the AnimationSet, frameLengthModifier, velocity, position, direction, /// and depth of the character. /// </summary> /// <param name="pipeline">List of objects from which the object should be drawn.</param> /// <param name="health">CharacterStatusElement for health</param> /// <param name="ammo">CharacterStatusElement for ammo</param> /// <param name="weapon">CharacterStatusElement for the current weapon</param> /// <param name="name">The character's name</param> /// <param name="detector">Collision detector with which this object should register.</param> /// <param name="animations">AnimationSet containing all animations for this object</param> /// <param name="frameLengthModifier">Float representing the ratio of frames in an animation to movement along the screen</param> /// <param name="velocity">Vector of velocity, representing both direction of movement and magnitude</param> /// <param name="position">Position of object relative to the top left corner</param> /// <param name="direction">Vector representing the direction of the object</param> /// <param name="depth">Depth the object is to be drawn to</param> public NonPlayableCharacterAbstract(List<DrawableObjectAbstract> pipeline, CharacterHealth health, CharacterAmmo ammo, CharacterWeapon weapon, string name, CollisionDetectorInterface detector, AnimationSet animations, float frameLengthModifier, Vector2 velocity, Vector2 position, Vector2 direction, float depth) : base(pipeline, health, ammo, weapon, name, detector, animations, frameLengthModifier, velocity, position, direction, depth) { }
public void setWeapon(CharacterWeapon newWeapon) { this.weapon = newWeapon; }
public void SetControlWithCharacterWeapon(Character objChar, CharacterWeapon objCW) { _intCharacterID = objCW.CharacterID; _intWeaponID = objCW.WeaponID; _cwObjCW = objCW; string strWeaponAvail = ""; string DamageBonus = ""; string StunBonus = ""; if ((_OriginalCharWeaponID == 0) && (objCW.CharacterWeaponID != 0)) { _OriginalCharWeaponID = objCW.CharacterWeaponID; } //Move to Character the Attack and Damage Bonuses txtMeleeAttackBonus.Text = objCW.MeleeAttackBonus.ToString(); txtMeleeDamageBonus.Text = objCW.MeleeDamageBonus.ToString(); txtRangeAttackBonus.Text = objCW.RangeAttackBonus.ToString(); txtRangeDamageBonus.Text = objCW.RangeDamageBonus.ToString(); txtWeaponName.Text = objCW.objWeapon.WeaponName; txtCharacterWeaponNotes.Text = objCW.Notes; if (objCW.objWeapon.ExtraDamage != 0) { DamageBonus = "+" + objCW.objWeapon.ExtraDamage; } else { DamageBonus = ""; } if (objCW.objWeapon.ExtraStunDamage != 0) { StunBonus = "+" + objCW.objWeapon.ExtraStunDamage; } else { StunBonus = ""; } txtDamage.Text = objCW.objWeapon.DamageDieNumber.ToString() + "d" + objCW.objWeapon.DamageDieType.ToString() + DamageBonus; if (objCW.objWeapon.Stun) { txtStunDamage.Text = objCW.objWeapon.StunDieNumber.ToString() + "d" + objCW.objWeapon.StunDieType.ToString() + StunBonus; } else { txtStunDamage.Text = ""; } txtWeight.Text = objCW.objWeapon.Weight.ToString(); txtBook.Text = objCW.objWeapon.objBook.BookName; txtWeaponType.Text = objCW.objWeapon.objWeaponType.WeaponTypeDescription; txtWeaponSize.Text = objCW.objWeapon.objWeaponSize.WeaponSizeName; txtRateOfFire.Text = objCW.objWeapon.RateOfFire; if (objCW.objWeapon.lstWeaponAvailability.Count > 0) { foreach (ItemAvailabilityType objIAT in objCW.objWeapon.lstWeaponAvailability) { strWeaponAvail = strWeaponAvail + objIAT.ItemAvailabilityTypeName + ", "; } strWeaponAvail = strWeaponAvail.Substring(0, strWeaponAvail.Length - 2); } txtAvailability.Text = strWeaponAvail; this.ckbAccurate.Checked = objCW.objWeapon.Accurate; this.ckbAreaOfAttack.Checked = objCW.objWeapon.AreaOfAttack; this.ckbDoubleWeapon.Checked = objCW.objWeapon.DoubleWeapon; this.ckbInaccurate.Checked = objCW.objWeapon.Inaccurate; this.ckbRequiresOrdiance.Checked = objCW.objWeapon.RequiresSeperateAmmo; this.ckbSlugThrower.Checked = objCW.objWeapon.Slugthrower; SetRanges(objCW.objWeapon.objRanges); SetAttackAndDamageBonusesVisibility(objCW); LoadModificationListView(); }