public void setEffekt(Enums.Effects effect) { effekt = effect; if (effekt == Enums.Effects.Fire) { foreach (Cell c in betroffeneZellen) { c.setOnFire = true; if (c.isOccupied) { if (c.objectOnCell.tag == "FigurSpieler1" || c.objectOnCell.tag == "FigurSpieler2") { hs.inflictFireDamage((AttributeComponent)c.objectOnCell.GetComponent(typeof(AttributeComponent))); } } } } if (effekt == Enums.Effects.Smoke) { foreach (Cell c in betroffeneZellen) { c.smoked = true; } } if (effekt == Enums.Effects.Gas) { foreach (Cell c in betroffeneZellen) { c.setOnGas = true; if (c.isOccupied) { if (c.objectOnCell.tag == "FigurSpieler1" || c.objectOnCell.tag == "FigurSpieler2") { hs.inflictGasDamage((AttributeComponent)c.objectOnCell.GetComponent(typeof(AttributeComponent))); } } } } if (effekt == Enums.Effects.Explosion) { foreach (Cell c in betroffeneZellen) { if(c.isOccupied) { if (c.objectOnCell.tag == "FigurSpieler1" || c.objectOnCell.tag == "FigurSpieler2") { hs.inflictGrenadeDamage((AttributeComponent)c.objectOnCell.GetComponent(typeof(AttributeComponent))); } } } } }
//Methode um anfangen shit zu schmeißen public IEnumerator throwGrenade(Cell ziel, GameObject figur, Enums.Effects effectType) { throwing_throwersAttributes = figur.GetComponent<AttributeComponent>(); InventoryComponent invent = figur.GetComponent<InventoryComponent>(); throwing_DestinationCell = ziel; int amountOfGrenades = 0; switch(effectType) { case Enums.Effects.Explosion: amountOfGrenades = invent.amountGrenades; break; case Enums.Effects.Fire: amountOfGrenades = invent.amountMolotovs; break; case Enums.Effects.Gas: amountOfGrenades = invent.amountTeargas; break; case Enums.Effects.Smoke: amountOfGrenades = invent.amountSmokes; break; } if (ziel.dij_GesamtKosten <= throwing_throwersAttributes.attackRange && amountOfGrenades > 0) { figur.GetComponentInParent<PlayerComponent>().useAP(); throw_turning = true; while(throw_turning) yield return null; //Einsatz von AP durch Faehigkeit figur.GetComponentInParent<PlayerComponent>().useAP(); throwing_effect = effectType; throwing_throwersAttributes.anim.SetTrigger("Throw"); switch (effectType) { case Enums.Effects.Explosion: invent.amountGrenades--; break; case Enums.Effects.Fire: invent.amountMolotovs--; break; case Enums.Effects.Gas: invent.amountTeargas--; break; case Enums.Effects.Smoke: invent.amountSmokes--; break; } } else { Debug.Log("OutOfRange"); } }
public void setNextGrenade(Enums.Effects type) { selectedGrenade = type; }