// Use this for initialization void Start() { _instance = this; _gameOver = false; _delayBeforeEnd = delayBeforeEnd; _delayBeforeStart = delayBeforeStart; _currentWave = 1; _spawnCounter = 0; _highlightedCells = new List <GameObject>(); _selectedWeapon = Weapon.Type.NULL; _currentMoney = startingMoney; _currentLives = lives; //make it static _waterGun = waterGun; _waterTurret = waterTurret; _stickySoap = stickySoap; _bucketCatapult = bucketCatapult; _coinText = coinText; _lifeText = lifeText; //set Uis _coinText.text = "" + _currentMoney + "$"; _lifeText.text = "" + _currentLives; _ballsOnScene = 0; _dirtsOnScene = 0; //START WAVE StartCoroutine(StartWave(3f)); }
// S E T U P W E A P O N A N I M A T I O N S // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void NewWeaponEquipped(Weapon.Type weaponType) { switch (weaponType) { case Weapon.Type.Sword: idle = Animator.StringToHash("SWORD_Idle"); run = Animator.StringToHash("SWORD_Run"); jump = Animator.StringToHash("SWORD_Jump"); attack = Animator.StringToHash("SWORD_Attack2"); break; case Weapon.Type.Axe: idle = Animator.StringToHash("SWORD_Idle"); run = Animator.StringToHash("SWORD_Run"); jump = Animator.StringToHash("SWORD_Jump"); attack = Animator.StringToHash("SWORD_Attack2"); break; case Weapon.Type.Hammer: idle = Animator.StringToHash("SWORD_Idle"); run = Animator.StringToHash("SWORD_Run"); jump = Animator.StringToHash("SWORD_Jump"); attack = Animator.StringToHash("SWORD_Attack2"); break; } }
public void RPC_Equip(Weapon.Type newWeaponType) { switch (newWeaponType) { case Weapon.Type.Classic: equiped = classic; break; case Weapon.Type.Sniper: equiped = sniper; break; case Weapon.Type.Bounce: equiped = bounce; break; case Weapon.Type.Sticky: equiped = sticky; break; case Weapon.Type.Fragmentation: equiped = fragmentation; break; } }
void NewWeaponEquipped(Weapon.Type weaponType) { switch (weaponType) { case Weapon.Type.Sword: weaponIdleAnimation = "SWORD_Idle"; weaponRunAnimation = "SWORD_Run"; weaponJumpAnimation = "SWORD_Jump"; weaponAttackAnimation = "SWORD_Attack"; break; case Weapon.Type.Axe: weaponIdleAnimation = "SWORD_Idle"; weaponRunAnimation = "SWORD_Run"; weaponJumpAnimation = "SWORD_Jump"; weaponAttackAnimation = "SWORD_Attack"; break; case Weapon.Type.Hammer: weaponIdleAnimation = "SWORD_Idle"; weaponRunAnimation = "SWORD_Run"; weaponJumpAnimation = "SWORD_Jump"; weaponAttackAnimation = "SWORD_Attack"; break; } }
public WeaponData(int equipId) { EquipData = GameUtil.GetEquipData(equipId); var prefix = equipId / 10000; Type = Weapon.ByValue(prefix); TwoHanded = (prefix == (int)Weapon.Type.STAFF) || (prefix >= (int)Weapon.Type.SWORD_2H && prefix <= (int)Weapon.Type.POLEARM) || (prefix == (int)Weapon.Type.CROSSBOW); var src = (WzSubProperty)Wz.Character["Weapon"][$"0{equipId}.img"]["info"]; Speed = (short)src["attackSpeed"]; Attack = ((WzShortProperty)src["attack"]).Value; var soundSrc = (WzSubProperty)Wz.Sound["Weapon.img"][src.GetString("sfx")].GetByUol(); _useSounds = new Dictionary <bool, WzObject>() { { false, soundSrc["Attack"] } }; if (soundSrc["Attack2"] != null) { _useSounds[true] = soundSrc["Attack2"]; } else { _useSounds[true] = soundSrc["Attack"]; } AfterImage = src.GetString("afterImage"); }
public static void SelectWeapon(Weapon.Type type) { if (_currentMoney < Weapon.GetCost(type)) { return; } _selectedWeapon = type; }
public Damage(Type damageType, Weapon.Type weaponType, string sendedUser, float amount, float knockback, bool knockdown) : base(RPCType.Others) { this.damageType = damageType; this.weaponType = weaponType; this.sendedUser = sendedUser; this.amount = amount; this.knockback = knockback; this.knockdown = knockdown; }
public object PackageUp(GameObject objectThatWasHit, Collider2D wasHitBy) { weapon = wasHitBy.GetComponent <Weapon>(); Assert.IsNotNull(weapon); weaponType = weapon.type; hitSideHoriz = M.HorizontalSideHit(objectThatWasHit, wasHitBy); hitSideVert = M.VerticalSideHit(objectThatWasHit, wasHitBy); return(this); }
public CourseCorrection(GameObject gameObject, float radiusOffset) { this.gameObject = gameObject; this.origin = gameObject.GetComponent <Rigidbody>().transform.position; this.radiusOffset = radiusOffset; this.avoidanceType = AvoidanceType.Unknown; this.vehicleType = Vehicle.Type.None; this.obstacleType = Obstacle.Type.None; this.weaponType = Weapon.Type.None; }
public void Equip(Weapon.Type type) { Expel(); //just in case if (type != Weapon.Type.NumTypes) { mCurWeapon = weapons[(int)type]; mCurWeapon.gameObject.SetActiveRecursively(true); mCurWeapon.Equip(); } }
public static void RemoveSelectedWeapon() { _selectedWeapon = Weapon.Type.NULL; if (_selectedTile != null) { _selectedTile.GetComponent <Tile>().UnHighlightTile(); } RemoveSelectedTile(); }
public object Create(GameObject objectThatWasHit, Collider2D wasHitBy) { weapon = wasHitBy.GetComponentInParent <Weapon>() ?? wasHitBy.GetComponentInParent <ProjectileContainer>().weapon; Assert.IsNotNull(weapon); weaponType = weapon.type; horizontalSide = M.HorizontalSideHit(objectThatWasHit, wasHitBy); verticalSide = M.VerticalSideHit(objectThatWasHit, wasHitBy); return(this); }
/* * */ public void LootAmmo(Weapon.Type weapon, int ammo) { System.Predicate <Weapon> weaponPredicate = weap => weap.WeaponType == weapon; if (weapons.Exists(weaponPredicate)) { weapons.Find(weaponPredicate).AmmoStandby += ammo; } else { weapons.Add(new Weapon(weapon, ammo)); } }
public Weapon GetWeapon(Weapon.Type weaponType) { for (int i = 0; i < _allWeapons.Length; i++) { Weapon weapon = _allWeapons[i]; if (weapon.GetWeaponType() == weaponType) { return(weapon); } } return(null); }
//Functions that take a raw data class and spit out an item. private Weapon process_wDC(WeaponDC rw) { int WIDNM = rw.IDNumber; int WCOST = rw.Cost; string WNAME = rw.Name; Weapon.Type WTYPE = 0; switch (rw.WeaponType) { case "Axe": WTYPE = Weapon.Type.Axe; break; case "Bow": WTYPE = Weapon.Type.Bow; break; case "Crossbow": WTYPE = Weapon.Type.Crossbow; break; case "Lance": WTYPE = Weapon.Type.Lance; break; case "Mace": WTYPE = Weapon.Type.Mace; break; case "Spear": WTYPE = Weapon.Type.Spear; break; case "Staff": WTYPE = Weapon.Type.Staff; break; case "Sword": WTYPE = Weapon.Type.Sword; break; } int WHAND = rw.Hands; int WMIND = rw.MinDamage; int WMAXD = rw.MaxDamage; int WRANG = rw.WeaponRange; return(new Weapon(WIDNM, WCOST, WNAME, WTYPE, WHAND, WMIND, WMAXD, WRANG)); }
void DealDamage(int inDamage, Weapon.Type inDamageType = Weapon.Type.None) { // Return if negative damage is recieved if (inDamage <= 0) { return; } float remainingDamage = inDamage; // Shield damage if shield is up if (_currentShield > 0) { if (inDamageType == Weapon.Type.Ballistic) { remainingDamage *= _shieldBallisticDamageModifier; } float previousShield = currentShield; currentShield -= remainingDamage; if (_currentShield <= 0) { OnShieldBreak?.Invoke(); } remainingDamage -= previousShield; } if (remainingDamage <= 0) { return; } // Health damage if player is alive if (_currentHealth > 0) { currentHealth -= remainingDamage; if (_currentHealth <= 0) { OnDeath?.Invoke(); } } }
// Set specific equipement public void SetWeapon(Weapon.Type type) { DropWeapon(weapon); weapon = null; foreach (Weapon w in weaponList) { if (w.type == type) { w.gameObject.SetActive(true); weapon = w; } else { w.gameObject.SetActive(false); } } }
public EquipStat.Id GetSecondary(Weapon.Type weaponType) { switch (_id / 100) { case 2: return(EquipStat.Id.LUK); case 3: return(EquipStat.Id.STR); case 4: return(EquipStat.Id.DEX); case 5: return((weaponType == Weapon.Type.GUN) ? EquipStat.Id.STR : EquipStat.Id.DEX); default: return(EquipStat.Id.DEX); } }
//Método que activa el nuevo arma en el Array y desactiva la anterior public void ActivateWeapon(Weapon.Type weaponType) { int weaponIndex = (int)weaponType; if (weaponIndex >= 0 && weaponIndex < _allWeapons.Length) { Weapon desiredWeapon = _allWeapons[weaponIndex]; //Compruebo si el arma está desbloqueada if (desiredWeapon.GetCanUseWeapon()) { //desactivo el arma activa _activeWeapon.gameObject.SetActive(false); //cambio el arma activa y la activo _activeWeapon = desiredWeapon; _activeWeapon.gameObject.SetActive(true); _grabberR.enabled = false; UpdateHandAnimation(weaponIndex); } } }
void NewWeapon(string theName, Weapon.Type theType, int dmgMod, int spdMod, int defMod, int weaponLevel, Roll weaponRoll, params Attack[] attacks) { Weapon weapon; // Don't create a weapon that doesn't have any attacks if (null == attacks || 0 == attacks.Length) { return; } weapon = new Weapon(theName, theType, dmgMod, spdMod, defMod, weaponLevel, weaponRoll); // Add the attacks to the weapon foreach (Attack attack in attacks) { attack.roll = weaponRoll; weapon.AddAttack(attack); } // Ensure the weapons Dict is allocated if (null == weapons) { weapons = new Dictionary <int, Dictionary <string, Weapon> >(); } // Ensure the specified level in 'weapons' is allocated if (false == weapons.ContainsKey(weaponLevel)) { weapons[weaponLevel] = new Dictionary <string, Weapon>(); } // Add the weapon weapons[weaponLevel].Add(weapon.name, weapon); }
public void SetWeaponType(Weapon.Type w) { _weaponType = w; }
public SkillData(int id) { var strId = id.ToString().PadLeft(7, '0'); var jobId = strId.Substring(0, 3); var src = Wz.Skill[$"{jobId}.img"]["skill"][strId]; var strSrc = (WzSubProperty)Wz.String["Skill.img"][strId]; // 加载图标 _icons = new[] { new TextureD(src["icon"]), new TextureD(src["iconDisabled"]), new TextureD(src["iconMouseOver"]), }; // 加载文字 _name = strSrc["name"].GetString(); _desc = strSrc["desc"].GetString(); for (var level = 1; level < strSrc.WzProperties.Count; level++) { if (strSrc[$"h{level}"] == null) { break; } var hDesc = (WzStringProperty)strSrc[$"h{level}"]; _levels[level] = hDesc.Value; } // 加载统计 var levelSrc = (WzSubProperty)src["level"]; foreach (var sub in levelSrc.WzProperties) { var damage = sub["damage"].GetFloat() / 100; var mAtx = sub["mad"]?.GetInt() ?? 0; var fixDamage = sub["fixdamage"]?.GetInt() ?? 0; var mastery = sub["mastery"]?.GetInt() ?? 0; var attackCount = sub["attackCount"]?.GetShort() ?? 1; var mobCount = sub["mobCount"]?.GetShort() ?? 1; var bulletCount = sub["bulletCount"]?.GetShort() ?? 1; var bulletCost = sub["bulletConsume"]?.GetShort() ?? bulletCount; var hpCost = sub["hpCon"]?.GetShort() ?? 1; var mpCost = sub["mpCon"]?.GetShort() ?? 1; var chance = sub["prop"]?.GetFloat() / 100 ?? 0; var critical = 0f; var ignoreDef = 0f; var hRange = sub["range"]?.GetFloat() / 100 ?? 0; var(left, top) = sub["lt"]?.Pos() ?? new Vector2(); var(right, bottom) = sub["rb"]?.Pos() ?? new Vector2(); var range = new Rectangle((int)left, (int)right, (int)top, (int)bottom); var b = int.TryParse(sub.Name, out var level); if (!b) { level = -1; } _stats[level] = new Stats(damage, mAtx, fixDamage, mastery, attackCount, mobCount, bulletCount, bulletCost, hpCost, mpCost, chance, critical, ignoreDef, hRange, range); } _element = src["elemAttr"]?.GetString(); if (jobId.Equals("900") || jobId.Equals("910")) { _reqWeapon = Weapon.Type.NONE; } else { _reqWeapon = Weapon.ByValue(100 + src["weapon"]?.GetInt() ?? 0); } _masterLevel = _stats.Count; _passive = id % 10000 / 100 == 0; _flags = FlagsOf(id); _invisible = src["invisible"] == 1; // 加载必须技能 if (src["req"] == null) { return; } foreach (var sub in ((WzSubProperty)src["req"]).WzProperties.Cast <WzSubProperty>()) { if (!int.TryParse(sub.Name, out var skillId)) { continue; } var reqLv = sub.GetInt(); _reqSkills[skillId] = reqLv; } }
// 重新计算装备属性 public void ReCalcStats(Weapon.Type type) { _totalStats.Clear(); foreach (var keyValuePair in _inventories[InventoryType.Id.EQUIPPED]) { if (!_equips.ContainsKey(keyValuePair.Value.UniqueId)) { continue; } var equip = _equips[keyValuePair.Value.UniqueId]; foreach (var kv2 in _totalStats) { _totalStats[kv2.Key] = (short)(kv2.Value + equip.GetStat(kv2.Key)); } } int prefix; switch (type) { case Weapon.Type.BOW: prefix = 2060; break; case Weapon.Type.CROSSBOW: prefix = 2061; break; case Weapon.Type.CLAW: prefix = 2070; break; case Weapon.Type.GUN: prefix = 2330; break; default: prefix = 0; break; } _bulletSlot = 0; if (prefix > 0) { foreach (var keyValuePair in _inventories[InventoryType.Id.USE]) { var slot = keyValuePair.Value; if (slot.Count > 0 && slot.ItemId / 1000 == prefix) { _bulletSlot = keyValuePair.Key; break; } } } // todo // if (int bulletid = get_bulletid()) // totalstats[EquipStat.Id.WATK] += BulletData.get(bulletid).get_watk(); }
public void Equip(Weapon.Type newWeaponType) { PV.RPC(RPC_Functions.Equip, RpcTarget.All, newWeaponType); AmmoLeft = equiped.ammo; FireRate.SetValue(equiped.fireRate); }
public Weapon(Weapon.Type type, Weapon.Status status) { this.type = type; this.status = status; }