public bool CheckRectHit(TORect rect) { int rectCount = blockingRects.Count; if (rect.x < bounds.x) { return(true); } if (rect.x + rect.width > bounds.x + bounds.width) { return(true); } if (rect.y < bounds.y) { return(true); } if (rect.y + rect.height > bounds.y + bounds.height) { return(true); } for (int r = 0; r < rectCount; r++) { if (blockingRects[r].CheckIntersect(rect)) { return(true); } } return(false); }
public FSprite CreateDebugSprite(TORect rect, Color rectColor) { FSliceSprite debugSprite = new FSliceSprite("Debug/Square", rect.width, rect.height, 4, 4, 4, 4); debugSprite.color = rectColor; debugSprite.alpha = 0.7f; debugSprite.SetAnchor(0, 0); debugSprite.SetPosition(rect.x, rect.y); frontContainer.AddChild(debugSprite); return(debugSprite); }
public House(float x, float y, EntityArea entityArea) : base(entityArea) { this.x = x; this.y = y; main = new FContainer(); mainSprite = new FSprite("Arena/House_1"); mainSprite.y = -offsetY; main.AddChild(mainSprite); blockingRect = new TORect(x - 40, y - 24, 80, 42); }
public House(float x, float y, EntityArea entityArea) : base(entityArea) { this.x = x; this.y = y; main = new FContainer(); mainSprite = new FSprite("Arena/House_1"); mainSprite.y = -offsetY; main.AddChild(mainSprite); blockingRect = new TORect(x-40,y-24,80,42); }
public FenceV(float x, float y, EntityArea entityArea) : base(entityArea) { this.x = x; this.y = y; main = new FContainer(); mainSprite = new FSprite("Arena/fenceV_1"); mainSprite.y = -offsetY; main.AddChild(mainSprite); blockingRect = new TORect(x - 4, y - 30, 8, 60); blockingRect.shouldBlockVills = false; }
public FenceV(float x, float y, EntityArea entityArea) : base(entityArea) { this.x = x; this.y = y; main = new FContainer(); mainSprite = new FSprite("Arena/fenceV_1"); mainSprite.y = -offsetY; main.AddChild(mainSprite); blockingRect = new TORect(x-4,y-30,8,60); blockingRect.shouldBlockVills = false; }
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); } } }
public void HitVillagersInRect(Wolf wolf, TORect rect, float hitAngle) { if (Config.SHOULD_DEBUG_BLOCKING_RECTS) { var debugSprite = entityArea.CreateDebugSprite(rect, Color.blue); Go.to(debugSprite, 0.5f, new TweenConfig().alpha(0.0f).removeWhenComplete()); } for (int v = vills.Count - 1; v >= 0; v--) //reverse for easy removal { var vill = vills[v]; if (rect.Contains(vill.x, vill.y)) { vill.Hit(wolf, hitAngle); } } }
public bool CheckRectHit(TORect rect) { int rectCount = blockingRects.Count; if(rect.x < bounds.x) return true; if(rect.x+rect.width > bounds.x+bounds.width) return true; if(rect.y < bounds.y) return true; if(rect.y+rect.height > bounds.y+bounds.height) return true; for(int r = 0; r<rectCount; r++) { if(blockingRects[r].CheckIntersect(rect)) { return true; } } return false; }
public Human(WolfActivePlayer player, EntityArea entityArea, bool shouldStartWithTransform) : base(entityArea) { this.player = player; isTransformingFromWolf = shouldStartWithTransform; tranPercent = 0.0f; offsetY = 18f; body = new FContainer(); bodySprite = new FSprite(HumanAnimation.Idle.frames[0]); body.AddChild(bodySprite); bodySprite.color = player.player.color.color + new Color(0.7f,0.7f,0.7f,0.0f); bodySprite.y = offsetY; body.scaleX = player.isFacingLeft ? 1f : -1f; // colorSprite = new FSprite("Arena/Human_Idle1_color"); // colorSprite.color = player.player.color.color; // body.AddChild(colorSprite); shadowSprite = new FSprite("Arena/VillShadow"); shadowSprite.alpha = 0.2f; shadowSprite.scaleX = 1.9f; shadowSprite.scaleY = 1.0f; attackableRect = new TORect(0,0,62,29); healthBar = new HumanHealthBar(this); healthBar.alpha = 0.0f; Go.to(healthBar, 1.0f, new TweenConfig().alpha(1.0f)); float healthPercent = ((float)player.health / (float)Config.HUMAN_MAX_HEALTH); healthBar.SetPercent(healthPercent); }
public Human(WolfActivePlayer player, EntityArea entityArea, bool shouldStartWithTransform) : base(entityArea) { this.player = player; isTransformingFromWolf = shouldStartWithTransform; tranPercent = 0.0f; offsetY = 18f; body = new FContainer(); bodySprite = new FSprite(HumanAnimation.Idle.frames[0]); body.AddChild(bodySprite); bodySprite.color = player.player.color.color + new Color(0.7f, 0.7f, 0.7f, 0.0f); bodySprite.y = offsetY; body.scaleX = player.isFacingLeft ? 1f : -1f; // colorSprite = new FSprite("Arena/Human_Idle1_color"); // colorSprite.color = player.player.color.color; // body.AddChild(colorSprite); shadowSprite = new FSprite("Arena/VillShadow"); shadowSprite.alpha = 0.2f; shadowSprite.scaleX = 1.9f; shadowSprite.scaleY = 1.0f; attackableRect = new TORect(0, 0, 62, 29); healthBar = new HumanHealthBar(this); healthBar.alpha = 0.0f; Go.to(healthBar, 1.0f, new TweenConfig().alpha(1.0f)); float healthPercent = ((float)player.health / (float)Config.HUMAN_MAX_HEALTH); healthBar.SetPercent(healthPercent); }
public void AddBlockingRect(TORect rect) { blockingRects.Add(rect); }
public void RemoveBlockingRect(TORect rect) { blockingRects.Remove(rect); }
public FSprite CreateDebugSprite(TORect rect, Color rectColor) { FSliceSprite debugSprite = new FSliceSprite("Debug/Square",rect.width,rect.height,4,4,4,4); debugSprite.color = rectColor; debugSprite.alpha = 0.7f; debugSprite.SetAnchor(0,0); debugSprite.SetPosition(rect.x,rect.y); frontContainer.AddChild(debugSprite); return debugSprite; }
public void HitVillagersInRect(Wolf wolf, TORect rect, float hitAngle) { if(Config.SHOULD_DEBUG_BLOCKING_RECTS) { var debugSprite = entityArea.CreateDebugSprite(rect, Color.blue); Go.to(debugSprite, 0.5f, new TweenConfig().alpha(0.0f).removeWhenComplete()); } for(int v = vills.Count-1; v>= 0; v--) //reverse for easy removal { var vill = vills[v]; if(rect.Contains(vill.x,vill.y)) { vill.Hit(wolf, hitAngle); } } }
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); } } }