private void onEnable() { if (GetComponentInParent <TowerBase>()) { debuffType = GetComponentInParent <TowerBase>().element; } }
public virtual void ActivateDebuff(float multiplier, float duration, Enums.Element debuffType) { if (status == Enums.Status.disable || debuffs == null) { return; } if (debuffType == element) { return; } Debuff debuff = debuffs[debuffType]; debuff.Refresh(multiplier, duration); if (!debuff.isActive) { debuff.isActive = true; switch (debuffType) { case Enums.Element.fire: StartCoroutine(ApplyFire()); break; case Enums.Element.acid: StartCoroutine(ApplyAcid()); break; case Enums.Element.ice: StartCoroutine(ApplySlow()); break; } } }
void OnTriggerEnter(Collider col) { Weapons.Hitbox hitbox = col.gameObject.GetComponent <Weapons.Hitbox>(); if (hitbox != null && !invun) { hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } }
/// <summary> /// Adds an Elements visual effects to a Gameobject by enum /// </summary> /// <param name="obj">Object which needs element effects added.</param> /// <param name="element">Element added to the game object.</param> public static void AddElementByEnum(GameObject obj, Enums.Element element, bool replaceMat) { Debug.Log("Elements/" + element + "ParticleSys"); GameObject particle = GameObject.Instantiate(Resources.Load("Elements/" + element + "ParticleSys"), obj.transform.position, obj.transform.rotation) as GameObject; particle.GetComponent <ParticleFollow>().target = obj.transform.GetChild(0).gameObject; if (replaceMat) { obj.transform.GetChild(0).gameObject.GetComponent <Renderer>().material = Mats[(int)element]; } }
public void Okay() { CardSystem.BoosterPackReader packReader = GameObject.FindObjectOfType <CardSystem.BoosterPackReader>(); GameObject newDeck = new GameObject(); newDeck.transform.name = "DeckTransfer " + thisPlayerIndex.ToString(); newDeck.AddComponent <DeckTransfer>(); List <CardSystem.Card> cards = new List <CardSystem.Card>(); Dictionary <Enums.Element, int> map = new Dictionary <Enums.Element, int>(); for (int i = 0; i < selectedPacks.Count; i++) { cards.AddRange(packReader.BoosterPacks[selectedPacks[i]].GetCards()); Enums.Element key = elementMap[selectedPacks[i]]; if (!map.ContainsKey(key)) { map.Add(key, 1); } else { int value = 0; map.TryGetValue(key, out value); map[key] = value + 1; } } Enums.Element playerType = Enums.Element.None; int max = 0; foreach (KeyValuePair <Enums.Element, int> entry in map) { if (entry.Value > max) { max = entry.Value; playerType = entry.Key; } } CardSystem.Deck deck = new CardSystem.Deck(cards); DeckTransfer t = newDeck.GetComponent <DeckTransfer>(); t.Deck = deck; t.Element = playerType; DontDestroyOnLoad(newDeck); // Load loading screen, correct level should already be stored from Main Menu LoadingScreen.instance.LoadLevel(LoadingScreen.LevelToLoad); }
public virtual void TakeDamage(float amount, float piercingValue, Enums.Element turretElement) { if (element == turretElement) { amount *= (1 - resistance); } float multiplier = armor * (1 - piercingValue); //health -= amount * (1 - multiplier); ApplyDamage(amount, multiplier); healthBar.fillAmount = health / initialHp; if (health <= 0) { Die(); } healthBar.fillAmount = health / initialHp; }
public virtual void Damage(double damage, Enums.Element element = Enums.Element.None, Enums.DamageType damageType = Enums.DamageType.Direct, Creature attacker = null) { if (damageType == Enums.DamageType.Physical && (AbsoluteImmortal || PhysicalImmortal)) { return; } if (damageType == Enums.DamageType.Magical && (AbsoluteImmortal || MagicalImmortal)) { return; } if (damageType != Enums.DamageType.Direct) { double armor = Ac * -1 + 100; var resist = Game.ElementTable[(int)element, 0]; var reduction = damage * (armor / (armor + 50)); damage = (damage - reduction) * resist; } if (attacker != null) { _mLastHitter = attacker.Id; } var normalized = (uint)damage; if (normalized > Hp) { normalized = Hp; } Hp -= normalized; SendDamageUpdate(this); if (Hp == 0) { OnDeath(); } }
private void SetElement(string type) { try { Enums.Element element = (Enums.Element)Enum.Parse(typeof(Enums.Element), type); if (Enum.IsDefined(typeof(Enums.Element), element) | element.ToString().Contains(",")) { this.element = element; } else { this.element = Enums.Element.None; Debug.LogError("Unable to resolve " + type + " to a type. Setting " + name + " to type None."); } } catch (ArgumentException) { this.type = Enums.CardTypes.Error; Debug.LogError("Unable to resolve " + type + " to a type. Setting " + name + " to type Error."); } }
public static Color ColorFromElement(Enums.Element element) { switch (element) { case Enums.Element.Fire: return(Convert255(175.0f, 30.0f, 30.0f)); case Enums.Element.Water: return(Convert255(30.0f, 30.0f, 175.0f)); case Enums.Element.Thunder: return(Convert255(225.0f, 225.0f, 30.0f)); case Enums.Element.Earth: return(Convert255(85.0f, 50.0f, 15.0f)); case Enums.Element.Wood: return(Convert255(30.0f, 175.0f, 30.0f)); default: return(Convert255(128.0f, 128.0f, 128.0f)); } }
public Color GetElementDisplay(Enums.Element element) { switch (element) { case Enums.Element.Fire: return(new Color(175.0f / 255, 30.0f / 255, 30.0f / 255)); case Enums.Element.Water: return(new Color(30.0f / 255, 30.0f / 255, 175.0f / 255)); case Enums.Element.Thunder: return(new Color(225.0f / 255, 225.0f / 255, 30.0f / 255)); case Enums.Element.Earth: return(new Color(85.0f / 255, 50.0f / 255, 15.0f / 255)); case Enums.Element.Wood: return(new Color(30.0f / 255, 175.0f / 255, 30.0f / 255)); default: return(new Color(128.0f / 255, 128.0f / 255, 128.0f / 255)); } }
public override void Damage(double damage, Enums.Element element = Enums.Element.None, Enums.DamageType damageType = Enums.DamageType.Direct, DamageFlags damageFlags = DamageFlags.None, Creature attacker = null, bool onDeath = true) { return; }
void Update() { if (Managers.GameManager.State == Enums.GameStates.Battle && !stun) { if (paused) { paused = false; anim.speed = animSpeed; } #region detectMove if (CustomInput.BoolFreshPress(CustomInput.UserInput.Up, playerNumber)) { if (currentNode.panelAllowed(Enums.Direction.Up, Type)) { directionToMove = Enums.Direction.Up; nextNode = currentNode.Up; } } else if (CustomInput.BoolFreshPress(CustomInput.UserInput.Down, playerNumber)) { if (currentNode.panelAllowed(Enums.Direction.Down, Type)) { directionToMove = Enums.Direction.Down; nextNode = currentNode.Down; } } else if (CustomInput.BoolFreshPress(CustomInput.UserInput.Left, playerNumber)) { if (currentNode.panelAllowed(Enums.Direction.Left, Type)) { directionToMove = Enums.Direction.Left; nextNode = currentNode.Left; } } else if (CustomInput.BoolFreshPress(CustomInput.UserInput.Right, playerNumber)) { if (currentNode.panelAllowed(Enums.Direction.Right, Type)) { directionToMove = Enums.Direction.Right; nextNode = currentNode.Right; } } else { directionToMove = Enums.Direction.None; } #endregion //get next state currState = machine.update(hit, animDone, directionToMove, hand.GetCurrentType(), hand.Empty(), playerNumber); //state clean up if (prevState != currState) { doOnce = false; animDone = false; attack = false; basicAttack = false; move = false; hit = false; if (weapon != null) { Destroy(weapon); } anim.SetInteger("state", (int)currState); } if (invunTimer > 0) { if (renderTimer > renderTime) { render = !render; renderTimer = 0; foreach (SkinnedMeshRenderer b in body) { b.enabled = render; } } hit = false; renderTimer += Time.deltaTime; invunTimer -= Time.deltaTime; } else if (!render || invun) { render = true; foreach (SkinnedMeshRenderer b in body) { b.enabled = true; } invun = false; } //run state switch (currState) { case Enums.PlayerState.Idle: Idle(); break; case Enums.PlayerState.MoveBegining: MoveBegining(); break; case Enums.PlayerState.MoveEnding: MoveEnding(); break; case Enums.PlayerState.Hit: Hit(); break; case Enums.PlayerState.Dead: Dead(); break; case Enums.PlayerState.BasicAttack: BasicAttack(); break; case Enums.PlayerState.HoriSwingMid: CardAnim(); break; case Enums.PlayerState.VertiSwingHeavy: CardAnim(); break; case Enums.PlayerState.ThrowLight: CardAnim(); break; case Enums.PlayerState.ThrowMid: CardAnim(); break; case Enums.PlayerState.Shoot: CardAnim(); break; case Enums.PlayerState.ChiAttack: CardAnim(); break; case Enums.PlayerState.ChiStationary: CardAnim(); break; case Enums.PlayerState.TauntGokuStretch: Taunt(); break; case Enums.PlayerState.TauntPointPoint: Taunt(); break; case Enums.PlayerState.TauntThumbsDown: Taunt(); break; case Enums.PlayerState.TauntWrasslemania: Taunt(); break; case Enums.PlayerState.TauntYaMoves: Taunt(); break; } if (move) { move = false; currentNode.clearOccupied(); currentNode = nextNode; currentNode.Owner = (this); transform.position = currentNode.transform.position; } #region useCard if (useCard) { if (!hand.Empty()) { Enums.CardTypes type = hand.GetCurrentType(); if (type == Enums.CardTypes.SwordHori || type == Enums.CardTypes.SwordVert) { weapon = Instantiate(Katana); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } if (type == Enums.CardTypes.WideSword) { weapon = Instantiate(WideSword); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.NaginataHori || type == Enums.CardTypes.NaginataVert) { weapon = Instantiate(Naginata); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.HammerHori || type == Enums.CardTypes.HammerVert) { weapon = Instantiate(Hammer); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.Fan) { weapon = Instantiate(Fan); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.Kanobo) { weapon = Instantiate(Kanobo); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale / .8f; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.Tanto) { weapon = Instantiate(Tanto); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.Wakizashi) { weapon = Instantiate(Wakizashi); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.Tonfa) { weapon = Instantiate(Tonfa); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale / .8f; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.BoStaff) { weapon = Instantiate(BoStaff); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale / .5f; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } int sfxNumber = 0; switch (type) { case Enums.CardTypes.SwordVert: case Enums.CardTypes.SwordHori: case Enums.CardTypes.WideSword: case Enums.CardTypes.NaginataVert: case Enums.CardTypes.NaginataHori: case Enums.CardTypes.HammerVert: case Enums.CardTypes.HammerHori: case Enums.CardTypes.Fan: case Enums.CardTypes.Kanobo: case Enums.CardTypes.Tanto: case Enums.CardTypes.Wakizashi: case Enums.CardTypes.Tonfa: case Enums.CardTypes.BoStaff: sfxNumber = 0; break; case Enums.CardTypes.ThrowLight: case Enums.CardTypes.ThrowMid: case Enums.CardTypes.Shoot: sfxNumber = 2; break; case Enums.CardTypes.ChiAttack: case Enums.CardTypes.ChiStationary: sfxNumber = 3; break; default: break; } sfx.PlaySong(sfxNumber); useCard = false; hand.UseCurrent(this, deck); CardUIEvent(); } } #endregion if (basicAttack) { basicAttack = false; Weapons.Hitbox b = Instantiate(bullet); AddElement.AddElementByEnum(b.gameObject, element, true); b.Owner = this.gameObject; b.transform.position = Direction == Enums.Direction.Left ? currentNode.Left.transform.position : currentNode.Right.transform.position; b.CurrentNode = Direction == Enums.Direction.Left ? currentNode.Left : currentNode.Right; b.Direction = Direction; if (playerNumber == 2) { Transform model = b.transform.GetChild(0); model.localScale = new Vector3(model.localScale.x, -model.localScale.y, model.localScale.z); } sfx.PlaySong(2); } if (damage > 0 && takeDamage) { takeDamage = false; TakeDamage(damage, damageElement); damage = 0; damageElement = Enums.Element.None; } prevState = currState; } else { if (!paused) { animSpeed = anim.speed; anim.speed = 0; paused = true; } if (stun) { if ((stunTimer += Time.deltaTime) > stunTime) { stunTimer = 0f; stun = false; } } } }
public virtual void Damage(double damage, Enums.Element element = Enums.Element.None, Enums.DamageType damageType = Enums.DamageType.Direct, Castables.DamageFlags damageFlags = Castables.DamageFlags.None, Creature attacker = null, bool onDeath = true) { if (attacker is User && this is Monster) { if (FirstHitter == null || !Game.World.ActiveUsersByName.ContainsKey(FirstHitter.Name) || ((DateTime.Now - LastHitTime).TotalSeconds > Constants.MONSTER_TAGGING_TIMEOUT)) { FirstHitter = attacker; } if (attacker != FirstHitter && !((FirstHitter as User).Group?.Members.Contains(attacker) ?? false)) { return; } } LastHitTime = DateTime.Now; if (damageType == Enums.DamageType.Physical && (AbsoluteImmortal || PhysicalImmortal)) { return; } if (damageType == Enums.DamageType.Magical && (AbsoluteImmortal || MagicalImmortal)) { return; } if (damageType != Enums.DamageType.Direct) { double armor = Stats.Ac * -1 + 100; var resist = Game.ElementTable[(int)element, 0]; var reduction = damage * (armor / (armor + 50)); damage = (damage - reduction) * resist; } if (attacker != null) { _mLastHitter = attacker.Id; } var normalized = (uint)damage; if (normalized > Stats.Hp && damageFlags.HasFlag(Castables.DamageFlags.Nonlethal)) { normalized = Stats.Hp - 1; } else if (normalized > Stats.Hp) { normalized = Stats.Hp; } Stats.Hp -= normalized; SendDamageUpdate(this); OnReceiveDamage(); // TODO: Separate this out into a control message if (Stats.Hp == 0 && onDeath == true) { OnDeath(); } }
private void SetElement(string type) { try { Enums.Element element = (Enums.Element)Enum.Parse(typeof(Enums.Element), type); if (Enum.IsDefined(typeof(Enums.Element), element) | element.ToString().Contains(",")) this.element = element; else { this.element = Enums.Element.None; Debug.LogError("Unable to resolve " + type + " to a type. Setting " + name + " to type None."); } } catch (ArgumentException) { this.type = Enums.CardTypes.Error; Debug.LogError("Unable to resolve " + type + " to a type. Setting " + name + " to type Error."); } }
public Pair(int value, Enums.Element type) { this.type = type; this.value = value; }
void Update() { if (Managers.GameManager.State == Enums.GameStates.Battle && !stun) { if (paused) { paused = false; anim.speed = animSpeed; } if (CustomInput.BoolFreshPress(CustomInput.UserInput.Up, playerNumber)) { if (currentNode.panelAllowed(Enums.Direction.Up, Type)) { directionToMove = Enums.Direction.Up; nextNode = currentNode.Up; } } else if (CustomInput.BoolFreshPress(CustomInput.UserInput.Down, playerNumber)) { if (currentNode.panelAllowed(Enums.Direction.Down, Type)) { directionToMove = Enums.Direction.Down; nextNode = currentNode.Down; } } else if (CustomInput.BoolFreshPress(CustomInput.UserInput.Left, playerNumber)) { if (currentNode.panelAllowed(Enums.Direction.Left, Type)) { directionToMove = Enums.Direction.Left; nextNode = currentNode.Left; } } else if (CustomInput.BoolFreshPress(CustomInput.UserInput.Right, playerNumber)) { if (currentNode.panelAllowed(Enums.Direction.Right, Type)) { directionToMove = Enums.Direction.Right; nextNode = currentNode.Right; } } else directionToMove = Enums.Direction.None; //get next state currState = machine.update(hit, animDone, directionToMove, hand.GetCurrentType(), hand.Empty(), playerNumber); //state clean up if (prevState != currState) { doOnce = false; animDone = false; attack = false; basicAttack = false; move = false; hit = false; if (weapon != null) Destroy(weapon); anim.SetInteger("state", (int)currState); } if (invunTimer > 0) { if (renderTimer > renderTime) { render = !render; renderTimer = 0; //GetComponent<Renderer>().enabled = render; } hit = false; renderTimer += Time.deltaTime; invunTimer -= Time.deltaTime; } else { //GetComponent<Renderer>().enabled = true; invun = false; } //run state switch (currState) { case Enums.PlayerState.Idle:Idle(); break; case Enums.PlayerState.MoveBegining: MoveBegining(); break; case Enums.PlayerState.MoveEnding: MoveEnding(); break; case Enums.PlayerState.Hit: Hit(); break; case Enums.PlayerState.Dead: Dead(); break; case Enums.PlayerState.BasicAttack: BasicAttack(); break; case Enums.PlayerState.HoriSwingMid: CardAnim(); break; case Enums.PlayerState.VertiSwingHeavy: CardAnim(); break; case Enums.PlayerState.ThrowLight: CardAnim(); break; case Enums.PlayerState.ThrowMid: CardAnim(); break; case Enums.PlayerState.Shoot: CardAnim(); break; case Enums.PlayerState.ChiAttack: CardAnim(); break; case Enums.PlayerState.ChiStationary: CardAnim(); break; case Enums.PlayerState.TauntGokuStretch: Taunt(); break; case Enums.PlayerState.TauntPointPoint: Taunt(); break; case Enums.PlayerState.TauntThumbsDown: Taunt(); break; case Enums.PlayerState.TauntWrasslemania: Taunt(); break; case Enums.PlayerState.TauntYaMoves: Taunt(); break; } if (move) { move = false; currentNode.clearOccupied(); currentNode = nextNode; currentNode.Owner = (this); transform.position = currentNode.transform.position; } if (useCard) { if (!hand.Empty()) { Enums.CardTypes type = hand.GetCurrentType(); if (type == Enums.CardTypes.SwordHori || type == Enums.CardTypes.SwordVert) { weapon = Instantiate(Katana); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0,0,0); } else if (type == Enums.CardTypes.NaginataHori || type == Enums.CardTypes.NaginataVert) { weapon = Instantiate(Naginata); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.HammerHori || type == Enums.CardTypes.HammerVert) { weapon = Instantiate(Hammer); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0,0,0); } else if (type == Enums.CardTypes.Fan) { weapon = Instantiate(Fan); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.Kanobo) { weapon = Instantiate(Kanobo); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.Tanto) { weapon = Instantiate(Tanto); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.Wakizashi) { weapon = Instantiate(Wakizashi); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.Tonfa) { weapon = Instantiate(Tonfa); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } else if (type == Enums.CardTypes.BoStaff) { weapon = Instantiate(BoStaff); weapon.transform.position = weaponPoint.position; weapon.transform.localScale = weaponPoint.localScale; weapon.transform.parent = weaponPoint; weapon.transform.localEulerAngles = new Vector3(0, 0, 0); } useCard = false; hand.UseCurrent(this); CardUIEvent(); } } if (basicAttack) { basicAttack = false; Weapons.Hitbox b = Instantiate(bullet); AddElement.AddElementByEnum(b.gameObject,(Enums.Element)Random.Range(0,5),true); b.Owner = this.gameObject; b.transform.position = Direction == Enums.Direction.Left ? currentNode.Left.transform.position : currentNode.Right.transform.position; b.CurrentNode = Direction == Enums.Direction.Left ? currentNode.Left : currentNode.Right; b.Direction = Direction; } if (damage > 0 && takeDamage) { takeDamage = false; TakeDamage(damage, damageElement); damage = 0; damageElement = Enums.Element.None; } prevState = currState; } else { if (!paused) { animSpeed = anim.speed; anim.speed = 0; paused = true; } if (stun) { if ((stunTimer += Time.deltaTime) > stunTime) { stunTimer = 0f; stun = false; } } } }
void OnTriggerEnter(Collider col) { Weapons.Hitbox hitbox = col.gameObject.GetComponent<Weapons.Hitbox>(); if (hitbox != null && !invun) { hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } }
void OnTriggerEnter(Collider col) { Weapons.Hitbox hitbox = col.gameObject.GetComponent <Weapons.Hitbox>(); if (hitbox != null && !invun) { if (hitbox.Owner == this.gameObject) { return; } if (hitbox.GetType() == typeof(Weapons.Projectiles.Tornado)) { if (hitbox.Direction == Enums.Direction.Left) { if (currentNode.panelAllowed(Util.Enums.Direction.Left, Type)) { currentNode = currentNode.Left; transform.position = CurrentNode.transform.position; } else { if (currentNode.panelAllowed(Util.Enums.Direction.Up, Type)) { currentNode = currentNode.Up; transform.position = CurrentNode.transform.position; hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } else if (currentNode.panelAllowed(Util.Enums.Direction.Down, Type)) { currentNode = currentNode.Down; transform.position = CurrentNode.transform.position; hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } } } else { if (currentNode.panelAllowed(Util.Enums.Direction.Right, Type)) { currentNode = currentNode.Right; transform.position = CurrentNode.transform.position; } else { if (currentNode.panelAllowed(Util.Enums.Direction.Up, Type)) { currentNode = currentNode.Up; transform.position = CurrentNode.transform.position; hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } else if (currentNode.panelAllowed(Util.Enums.Direction.Down, Type)) { currentNode = currentNode.Down; transform.position = CurrentNode.transform.position; hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } } } } else { hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } } Weapons.Projectiles.Stun s = col.gameObject.GetComponent <Weapons.Projectiles.Stun>(); if (s != null) { Stun = true; } }
public void Load(int moveNum) { using (XmlReader reader = XmlReader.Create(Paths.DataPath + "Move\\" + moveNum + ".xml")) { while (reader.Read()) { if (reader.IsStartElement()) { switch (reader.Name) { case "Name": { Name = reader.ReadString(); break; } case "Description": { Desc = reader.ReadString(); break; } case "PP": { PP = reader.ReadString().ToInt(); break; } case "Type": { Type = reader.ReadString().ToEnum<Enums.Element>(); break; } case "Category": { Category = reader.ReadString().ToEnum<Enums.MoveCategory>(); break; } case "Contact": { Contact = reader.ReadString().ToBool(); break; } case "SoundBased": { SoundBased = reader.ReadString().ToBool(); break; } case "FistBased": { FistBased = reader.ReadString().ToBool(); break; } case "PulseBased": { PulseBased = reader.ReadString().ToBool(); break; } case "BulletBased": { BulletBased = reader.ReadString().ToBool(); break; } case "JawBased": { JawBased = reader.ReadString().ToBool(); break; } case "Power": { Power = reader.ReadString().ToInt(); break; } case "Accuracy": { Accuracy = reader.ReadString().ToInt(); break; } case "Effect": { Effect = reader.ReadString().ToInt(); break; } case "Effect1": { Effect1 = reader.ReadString().ToInt(); break; } case "Effect2": { Effect2 = reader.ReadString().ToInt(); break; } case "Effect3": { Effect3 = reader.ReadString().ToInt(); break; } case "HitsSelf": { Range.HitsSelf = reader.ReadString().ToBool(); break; } case "HitsFriend": { Range.HitsFriend = reader.ReadString().ToBool(); break; } case "HitsFoe": { Range.HitsFoe = reader.ReadString().ToBool(); break; } case "Range": { Range.RangeType = reader.ReadString().ToEnum<Enums.RangeType>(); break; } case "Mobility": { Range.Mobility = reader.ReadString().ToInt(); break; } case "CutsCorners": { Range.CutsCorners = reader.ReadString().ToBool(); break; } case "Distance": { Range.Distance = reader.ReadString().ToInt(); break; } case "StartAnim": { StartAnim.Load(reader.ReadSubtree()); break; } case "StartUserAnim": { StartUserAnim.Load(reader.ReadSubtree()); break; } case "StartSound": { StartSound = reader.ReadString().ToInt(); break; } case "MidAnim": { MidAnim.Load(reader.ReadSubtree()); break; } case "MidUserAnim": { MidUserAnim.Load(reader.ReadSubtree()); break; } case "MidTargetAnim": { MidTargetAnim.Load(reader.ReadSubtree()); break; } case "MidSound": { MidSound = reader.ReadString().ToInt(); break; } case "EndAnim": { EndAnim.Load(reader.ReadSubtree()); break; } case "EndUserAnim": { EndUserAnim.Load(reader.ReadSubtree()); break; } case "EndTargetAnim": { EndTargetAnim.Load(reader.ReadSubtree()); break; } case "EndSound": { EndSound = reader.ReadString().ToInt(); break; } } } } } }
public void Damage(int damage, Enums.Element element = Enums.Element.None, Enums.DamageType damageType = Enums.DamageType.Direct) { User.Damage((double)damage, element, damageType); }
public virtual void ActivateDebuff(float multiplier, float duration, Enums.Element debuffType) { if (status == Enums.Status.disable || debuffs == null) { return; } if (debuffType == element) { return; } Debuff debuff = debuffs[debuffType]; debuff.Refresh(multiplier, duration); if (!debuff.isActive) { debuff.isActive = true; switch (debuffType) { case Enums.Element.fire: if (fireRoutine != null) { StopCoroutine(fireRoutine); ((System.IDisposable)ApplyFire()).Dispose(); if (fireDebuffEffect != null) { Destroy(fireDebuffEffect); } } fireRoutine = StartCoroutine(ApplyFire()); break; case Enums.Element.acid: if (acidRoutine != null) { StopCoroutine(acidRoutine); ((System.IDisposable)ApplyAcid()).Dispose(); if (acidDebuffEffect != null) { Destroy(acidDebuffEffect); } } acidRoutine = StartCoroutine(ApplyAcid()); break; case Enums.Element.ice: if (slowRoutine != null) { StopCoroutine(slowRoutine); ((System.IDisposable)ApplySlow()).Dispose(); if (slowDebuffEffect != null) { Destroy(slowDebuffEffect); } } slowRoutine = StartCoroutine(ApplySlow()); break; } } }
}; //None public static float GetDamageMultiplier(Enums.Element me, Enums.Element them) { return(damageValues[(int)me, (int)them]); }
void OnTriggerEnter(Collider col) { Weapons.Hitbox hitbox = col.gameObject.GetComponent<Weapons.Hitbox>(); if (hitbox != null && !invun) { if (hitbox.Owner == this.gameObject) return; if (hitbox.GetType() == typeof(Weapons.Projectiles.Tornado)) { if(hitbox.Direction == Enums.Direction.Left) { if (currentNode.panelAllowed(Util.Enums.Direction.Left, Type)) { currentNode = currentNode.Left; transform.position = CurrentNode.transform.position; } else { if (currentNode.panelAllowed(Util.Enums.Direction.Up, Type)) { currentNode = currentNode.Up; transform.position = CurrentNode.transform.position; hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } else if (currentNode.panelAllowed(Util.Enums.Direction.Down, Type)) { currentNode = currentNode.Down; transform.position = CurrentNode.transform.position; hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } } } else { if (currentNode.panelAllowed(Util.Enums.Direction.Right, Type)) { currentNode = currentNode.Right; transform.position = CurrentNode.transform.position; } else { if (currentNode.panelAllowed(Util.Enums.Direction.Up, Type)) { currentNode = currentNode.Up; transform.position = CurrentNode.transform.position; hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } else if (currentNode.panelAllowed(Util.Enums.Direction.Down, Type)) { currentNode = currentNode.Down; transform.position = CurrentNode.transform.position; hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } } } } else { hit = true; damage = hitbox.Damage; damageElement = hitbox.Element; } } Weapons.Projectiles.Stun s = col.gameObject.GetComponent<Weapons.Projectiles.Stun>(); if (s != null) Stun = true; }