public VillDeathCloud(Vill vill) : base(vill.entityArea) { this.vill = vill; this.x = vill.x; this.y = vill.y + 4; frames = new FAtlasElement[] { Futile.atlasManager.GetElementWithName("Arena/Vill_Death1"), Futile.atlasManager.GetElementWithName("Arena/Vill_Death2"), Futile.atlasManager.GetElementWithName("Arena/Vill_Death3"), Futile.atlasManager.GetElementWithName("Arena/Vill_Death4") }; cloudHolder = new FContainer(); cloudSprite = new FSprite(frames[0]); cloudSprite.scaleX = RXRandom.Bool() ? -1f : 1f; cloudHolder.AddChild(cloudSprite); cloudSprite.shader = FShader.Additive; cloudSprite.alpha = RXRandom.Range(0.8f, 0.9f); cloudSprite.color = vill.player.player.color.color + new Color(0.1f, 0.1f, 0.1f, 0.0f); graveHolder = new FContainer(); graveSprite = new FSprite("Arena/VillGrave1_body"); graveHolder.AddChild(graveSprite); graveSpriteColor = new FSprite("Arena/VillGrave1_color"); graveHolder.AddChild(graveSpriteColor); graveSpriteColor.color = vill.player.player.color.color + new Color(0.5f, 0.5f, 0.5f); graveSprite.y = graveSpriteColor.y = 5; Update(); }
public void Hit(Vill vill, float hitAngle) { if (isTransformingToWolf || isTransformingFromWolf || isDead) { return; } // Vector2 offset = new Vector2(wolf.x - x,wolf.y + 10 - y).normalized * -1f; float rads = -hitAngle * RXMath.DTOR + Mathf.PI; Vector2 offset = new Vector2(Mathf.Cos(rads), Mathf.Sin(rads)); pushSpeed += offset * 0.2f; player.health--; float healthPercent = ((float)player.health / (float)Config.HUMAN_MAX_HEALTH); healthBar.SetPercent(healthPercent); healthBar.Hit(); if (player.health <= 0) { Die(); } }
public void OnVillDeath(Vill vill) { vills.Remove(vill); arena.vills.Remove(vill); var cloud = new VillDeathCloud(vill); cloud.AddToArea(); if (vills.Count == 0) { DoDead(); } }
public VillAttackBeam(Vill vill, float angle) : base(vill.entityArea) { this.vill = vill; this.angle = angle; main = new FContainer(); main.rotation = angle; sprite = new FSprite("Arena/Wolf_AttackBeam"); sprite.scale = 0.5f; sprite.x = -2f; main.AddChild(sprite); sprite.shader = FShader.Additive; sprite.color = vill.player.player.color.color; }
public void HitHumansInRect(Vill vill, TORect rect, float hitAngle) { if (Config.SHOULD_DEBUG_BLOCKING_RECTS) { var debugSprite = entityArea.CreateDebugSprite(rect, Color.green); Go.to(debugSprite, 0.5f, new TweenConfig().alpha(0.0f).removeWhenComplete()); } for (int h = humans.Count - 1; h >= 0; h--) //reverse for easy removal { var human = humans[h]; if (rect.CheckIntersect(human.attackableRect)) { human.Hit(vill, hitAngle); } } }
override public void Start() { var startPos = RXRandom.GetRandomItem(arena.mapData.startPoses) as StartPosMI; arena.mapData.startPoses.Remove(startPos); Vector2 center = new Vector2(startPos.x, startPos.y); float radius = 40; int failsafe = 0; while (vills.Count < initialVillCount && failsafe++ < 1000) { Vector2 checkPos = center + (RXRandom.Vector2Normalized() * radius * RXRandom.Float()); if (!arena.entityArea.CheckPointHit(checkPos.x, checkPos.y)) { Vill vill = new Vill(this, arena.entityArea); vill.SetPosition(checkPos); vill.AddToArea(); vills.Add(vill); arena.vills.Add(vill); } } }
public VillDeathCloud(Vill vill) : base(vill.entityArea) { this.vill = vill; this.x = vill.x; this.y = vill.y+4; frames = new FAtlasElement[] { Futile.atlasManager.GetElementWithName("Arena/Vill_Death1"), Futile.atlasManager.GetElementWithName("Arena/Vill_Death2"), Futile.atlasManager.GetElementWithName("Arena/Vill_Death3"), Futile.atlasManager.GetElementWithName("Arena/Vill_Death4") }; cloudHolder = new FContainer(); cloudSprite = new FSprite(frames[0]); cloudSprite.scaleX = RXRandom.Bool() ? -1f : 1f; cloudHolder.AddChild(cloudSprite); cloudSprite.shader = FShader.Additive; cloudSprite.alpha = RXRandom.Range(0.8f,0.9f); cloudSprite.color = vill.player.player.color.color + new Color(0.1f,0.1f,0.1f,0.0f); graveHolder = new FContainer(); graveSprite = new FSprite("Arena/VillGrave1_body"); graveHolder.AddChild(graveSprite); graveSpriteColor = new FSprite("Arena/VillGrave1_color"); graveHolder.AddChild(graveSpriteColor); graveSpriteColor.color = vill.player.player.color.color + new Color(0.5f,0.5f,0.5f); graveSprite.y = graveSpriteColor.y = 5; Update(); }
public void Hit(Vill vill, float hitAngle) { if(isTransformingToWolf || isTransformingFromWolf || isDead) return; // Vector2 offset = new Vector2(wolf.x - x,wolf.y + 10 - y).normalized * -1f; float rads = -hitAngle * RXMath.DTOR + Mathf.PI; Vector2 offset = new Vector2(Mathf.Cos(rads),Mathf.Sin(rads)); pushSpeed += offset * 0.2f; player.health--; float healthPercent = ((float)player.health / (float)Config.HUMAN_MAX_HEALTH); healthBar.SetPercent(healthPercent); healthBar.Hit(); if(player.health <= 0) { Die(); } }
public override void Start() { var startPos = RXRandom.GetRandomItem(arena.mapData.startPoses) as StartPosMI; arena.mapData.startPoses.Remove(startPos); Vector2 center = new Vector2(startPos.x,startPos.y); float radius = 40; int failsafe = 0; while(vills.Count < initialVillCount && failsafe++ < 1000) { Vector2 checkPos = center + (RXRandom.Vector2Normalized() * radius * RXRandom.Float()); if(!arena.entityArea.CheckPointHit(checkPos.x,checkPos.y)) { Vill vill = new Vill(this,arena.entityArea); vill.SetPosition(checkPos); vill.AddToArea(); vills.Add(vill); arena.vills.Add(vill); } } }
public void OnVillDeath(Vill vill) { vills.Remove(vill); arena.vills.Remove(vill); var cloud = new VillDeathCloud(vill); cloud.AddToArea(); if(vills.Count == 0) { DoDead(); } }
public void HitHumansInRect(Vill vill, TORect rect, float hitAngle) { if(Config.SHOULD_DEBUG_BLOCKING_RECTS) { var debugSprite = entityArea.CreateDebugSprite(rect, Color.green); Go.to(debugSprite, 0.5f, new TweenConfig().alpha(0.0f).removeWhenComplete()); } for(int h = humans.Count-1; h>= 0; h--) //reverse for easy removal { var human = humans[h]; if(rect.CheckIntersect(human.attackableRect)) { human.Hit(vill, hitAngle); } } }
override public void Update() { int villCount = vills.Count; Vector2 moveDir = player.device.LeftStick; bool shouldSpread = true; bool isHoldingButton = player.device.Action1.IsPressed || player.device.Action2.IsPressed || player.device.Action3.IsPressed || player.device.Action4.IsPressed; bool shouldSpreadOut = isHoldingButton ? true : false; float spreadModifier = shouldSpreadOut ? 1.0f : -0.25f; for (int a = 0; a < villCount; a++) { Vill villA = vills[a]; villA.hopper.inputDirection = moveDir; if (shouldSpread) { Vill closeVill = null; float closeDist = shouldSpreadOut ? float.MaxValue : float.MinValue; for (int b = 0; b < villCount; b++) { Vill villB = vills[b]; if (villB == villA) { continue; //can't be close to self } float dx = villA.x - villB.x; float dy = villA.y - villB.y; float dist = dx * dx + dy * dy; if (shouldSpreadOut) { if (dist < closeDist) { closeDist = dist; closeVill = villB; } } else { if (dist > closeDist) { closeDist = dist; closeVill = villB; } } } if (closeVill != null) { Vector2 delta = new Vector2(villA.x - closeVill.x, villA.y - closeVill.y); float force = 1.0f; if (shouldSpreadOut) { if (delta.magnitude == 0) { force = 1.0f; } else { force = Mathf.Clamp01(7.0f / delta.magnitude); } } else { force = 1.0f - Mathf.Clamp01(17.0f / delta.magnitude); } force *= force; villA.pushSpeed += delta.normalized * force * 0.3f * spreadModifier; } } } }