Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
    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);
    }
Esempio n. 4
0
    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);
    }
Esempio n. 5
0
    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;
    }
Esempio n. 6
0
    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;
    }
Esempio n. 7
0
    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);
            }
        }
    }
Esempio n. 8
0
    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);
            }
        }
    }
Esempio n. 9
0
    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;
    }
Esempio n. 10
0
    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);
    }
Esempio n. 11
0
    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);
    }
Esempio n. 12
0
 public void AddBlockingRect(TORect rect)
 {
     blockingRects.Add(rect);
 }
Esempio n. 13
0
 public void RemoveBlockingRect(TORect rect)
 {
     blockingRects.Remove(rect);
 }
Esempio n. 14
0
 public void AddBlockingRect(TORect rect)
 {
     blockingRects.Add(rect);
 }
Esempio n. 15
0
 public void RemoveBlockingRect(TORect rect)
 {
     blockingRects.Remove(rect);
 }
Esempio n. 16
0
 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;
 }
Esempio n. 17
0
    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);
            }
        }
    }
Esempio n. 18
0
    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);
            }
        }
    }