Example #1
0
    public Vill(VillagerActivePlayer player, EntityArea entityArea) : base(entityArea)
    {
        this.player = player;

        attackCooldown = RXRandom.Float();         //random cooldown to start so they're not synced

        offsetY = 6f;

        int numArts = 8;

        artIndex = RXRandom.Range(0, numArts) + 1;

        body       = new FContainer();
        bodySprite = new FSprite("Arena/Vill" + artIndex + "_body");
        body.AddChild(bodySprite);

        colorSprite       = new FSprite("Arena/Vill" + artIndex + "_color");
        colorSprite.color = player.player.color.color;
        body.AddChild(colorSprite);

        weapon = new FContainer();
        body.AddChild(weapon);

        string weaponName = RXRandom.GetRandomString("RollingPin", "Torch", "Pitchfork", "", "", "", "");   //Rake, FryingPan

        if (weaponName != "" && artIndex != 8)
        {
            if (weaponName == "Torch")
            {
                var torch = new VillTorch();
                weapon.AddChild(torch);
            }
            else
            {
                FSprite weaponSprite = new FSprite("Arena/" + weaponName + "_1");
                weapon.AddChild(weaponSprite);
            }
        }


        shadowSprite        = new FSprite("Arena/VillShadow");
        shadowSprite.alpha  = 0.2f;
        shadowSprite.scaleX = 0.7f;
        shadowSprite.scaleY = 0.5f;

        hopper = new Hopper(this);
        hopper.config.jumpDist     = RXRandom.Range(18f, 19f);
        hopper.config.jumpDuration = RXRandom.Range(0.2f, 0.24f);
        hopper.config.jumpHeight   = RXRandom.Range(3f, 4f);
    }
Example #2
0
    public Vill(VillagerActivePlayer player, EntityArea entityArea)
        : base(entityArea)
    {
        this.player = player;

        attackCooldown = RXRandom.Float(); //random cooldown to start so they're not synced

        offsetY = 6f;

        int numArts = 8;
        artIndex = RXRandom.Range(0,numArts)+1;

        body = new FContainer();
        bodySprite = new FSprite("Arena/Vill"+artIndex+"_body");
        body.AddChild(bodySprite);

        colorSprite = new FSprite("Arena/Vill"+artIndex+"_color");
        colorSprite.color = player.player.color.color;
        body.AddChild(colorSprite);

        weapon = new FContainer();
        body.AddChild(weapon);

        string weaponName = RXRandom.GetRandomString("RollingPin","Torch","Pitchfork","","","",""); //Rake, FryingPan

        if(weaponName != "" && artIndex != 8)
        {
            if(weaponName == "Torch")
            {
                var torch = new VillTorch();
                weapon.AddChild(torch);
            }
            else
            {
                FSprite weaponSprite = new FSprite("Arena/"+weaponName+"_1");
                weapon.AddChild(weaponSprite);
            }
        }

        shadowSprite = new FSprite("Arena/VillShadow");
        shadowSprite.alpha = 0.2f;
        shadowSprite.scaleX = 0.7f;
        shadowSprite.scaleY = 0.5f;

        hopper = new Hopper(this);
        hopper.config.jumpDist = RXRandom.Range(18f,19f);
        hopper.config.jumpDuration = RXRandom.Range(0.2f,0.24f);
        hopper.config.jumpHeight = RXRandom.Range(3f,4f);
    }