コード例 #1
0
    override public void init()
    {
        base.init();

        mBackground = new CSprite();
        mBackground.setImage(Resources.Load <Sprite> ("Sprites/ui/menu/fondo"));
        mBackground.setXY(0, 0);
        mBackground.setSortingLayerName("Background");
        mBackground.setName("background");



        mButtonPlay = new CButtonSprite("Play");
        mButtonPlay.setFrames(Resources.LoadAll <Sprite>("Sprites/ui/menu/button"));
        mButtonPlay.setName("PlayImage");
        mButtonPlay.setXY(CGameConstants.SCREEN_WIDTH / 2 + 700, CGameConstants.SCREEN_HEIGHT / 2 - 150);
        mButtonPlay.setScale(500);



        exitButton = new CButtonSprite("Exit");
        exitButton.setFrames(Resources.LoadAll <Sprite>("Sprites/ui/menu/button"));
        exitButton.setName("ExitImage");
        exitButton.setXY(mButtonPlay.getX(), CGameConstants.SCREEN_HEIGHT / 3 * 2 - 10);



        logo = new CText(" ");
        logo.setXY(CGameConstants.SCREEN_WIDTH / 2, CGameConstants.SCREEN_HEIGHT / 4 * 1);
        logo.setFontSize(1000f);
        logo.setPivot(0.5f, 0.5f);
        logo.setWidth(CGameConstants.SCREEN_WIDTH);
        logo.setAlignment(TMPro.TextAlignmentOptions.Center);
    }
コード例 #2
0
    public CAndy()
    {
        setFrames(Resources.LoadAll <Sprite> ("Sprites/nina"));
        setName("Nina");
        setSortingLayerName("Player");

        setScale(0.5f);

        setRegistration(CSprite.REG_TOP_LEFT);

        setWidth(WIDTH);
        setHeight(HEIGHT);

        // TODO: PASAR A LA CAMARA CUANDO SE IMPLEMENTE.
        CAudioManager.Inst.setAudioListener(this);
        CAudioManager.Inst.setPrimaryParent(this.getGameObject());

        // Agregate al audio manager como audio source.
        // Este objeto emite sonido.
        CAudioManager.Inst.addAudioSource(this).gameObject.transform.SetParent(this.getGameObject().transform);

        setState(STATE_STAND);

        if (this.debug)
        {
            mRect = new CSprite();
            mRect.setImage(Resources.Load <Sprite> ("Sprites/ui/pixel"));
            mRect.setSortingLayerName("Player");
            mRect.setSortingOrder(20);
            mRect.setAlpha(0.5f);
            mRect.setName("player_debug_rect");

            mRect2 = new CSprite();
            mRect2.setImage(Resources.Load <Sprite> ("Sprites/ui/pixel"));
            mRect2.setSortingLayerName("Player");
            mRect2.setSortingOrder(20);
            mRect2.setColor(Color.red);
            mRect2.setAlpha(0.5f);
            mRect2.setName("player_debug_rect2");
        }

        this.powers = new List <Power>();
        this.powers.Add(new Earth());
        this.powers.Add(new Air(this));
        this.powers.Add(new Water(this));
        this.powers.Add(new Fire(this));

        this.selectedPower = 0;

        this.powers[this.selectedPower].setActive();

        textoPoderes = new CText(this.powers[this.selectedPower].getName());
        textoPoderes.setWidth(this.getWidth());
        textoPoderes.setWrapping(false);
        textoPoderes.setFontSize(40f);
        textoPoderes.setXY(this.getX(), this.getY() - textoPoderes.getHeight());
        textoPoderes.setAlignment(TMPro.TextAlignmentOptions.Center);

        this.setBounds(0, 0, CTileMap.Instance.getMapWidth() * CTileMap.Instance.getTileWidth(), CTileMap.Instance.getMapHeight() * CTileMap.Instance.getTileHeight());
        this.setBoundAction(CGameObject.BOUNCE);
    }