Exemple #1
0
    public static void Init()
    {
        _elementSets = new MBeastElementSet[MColor.colors.Length*MBeastType.beastTypes.Length];

        int e = 0;
        for(int c = 0; c<MColor.colors.Length; c++)
        {
            for(int t = 0; t<MBeastType.beastTypes.Length; t++)
            {
                MBeastElementSet elementSet = new MBeastElementSet();
                _elementSets[e] = elementSet;
                elementSet.walkElements = new FAtlasElement[19];
                elementSet.attackElements = new FAtlasElement[19];
                elementSet.walkAndAttackElements = new FAtlasElement[elementSet.walkElements.Length + elementSet.attackElements.Length];

                int allIndex = 0;
                int walkIndex = 0;
                int attackIndex = 0;

                for(int f = 0; f<10; f++)
                {
                    elementSet.walkAndAttackElements[allIndex++] = elementSet.walkElements[walkIndex++] = Futile.atlasManager.GetElementWithName(c+"_"+t+"/Beast_walking_"+f+".png");
                }

                for(int f = 8; f>=0; f--)
                {
                    elementSet.walkAndAttackElements[allIndex++] = elementSet.walkElements[walkIndex++] = Futile.atlasManager.GetElementWithName(c+"_"+t+"/Beast_walking_"+f+".png");
                }

                for(int f = 0; f<10; f++)
                {
                    elementSet.walkAndAttackElements[allIndex++] = elementSet.attackElements[attackIndex++] = Futile.atlasManager.GetElementWithName(c+"_"+t+"/Beast_attacking_"+f+".png");
                }

                for(int f = 8; f>=0; f--)
                {
                    elementSet.walkAndAttackElements[allIndex++] = elementSet.attackElements[attackIndex++] = Futile.atlasManager.GetElementWithName(c+"_"+t+"/Beast_attacking_"+f+".png");
                }

                e++;
            }
        }
    }
Exemple #2
0
    public void Start(MPlayer player)
    {
        this.player = player;

        hasTarget = false;
        target = new Vector2(0,0);
        velocity = new Vector2(0,0);
        attackTarget = null;
        attackTower = null;
        isAttacking = false;
        isAttackingTower = false;
        attackFrame = 0;
        blinkFrame = 0;

        if(player.leapLevel < 1)
        {
            beastType = MBeastType.A;
        }
        else if(player.leapLevel < 2)
        {
            beastType = MBeastType.B;
        }
        else
        {
            beastType = MBeastType.C;
        }

        UpdateStats();

        _advanceCount = 0;

        _elementSet = _elementSets[player.color.index*MBeastType.beastTypes.Length + beastType.index];
        sprite.element = _elementSet.walkElements[0];
        sprite.color = MGame.colorWhite;

        this.scale = 0.0f;

        this.isEnabled = true;
    }