void OnMouseDown()
    {
        GameObject g = (GameObject)Instantiate(mRecordingPropPrefab, Vector3.zero, Quaternion.identity);

        g.transform.parent = mScreen.transform;

        Vector2 mousePosition = uImage.GetManager().ScreenToGui(new Vector2(Input.mousePosition.x, Input.mousePosition.y));

        dfTextureSprite sprite = (dfTextureSprite)g.GetComponent(typeof(dfTextureSprite));
        // TODO: these numbers are hardcoded - copied from the unity gui - figure out how to get this programatically
        Vector2 top_left = new Vector2(mousePosition.x - 183, (0 - mousePosition.y) + 123);

        sprite.Position = new Vector2(top_left.x - (sprite.Size.x / 2), top_left.y + (sprite.Size.y / 2));
        sprite.Texture  = (Texture2D)Resources.Load("Props/" + uPurchasedProp.uProp.uID);
        sprite.Size     = new Vector2(sprite.Texture.width, sprite.Texture.height);

        RecordingProp r = (RecordingProp)g.GetComponent(typeof(RecordingProp));

        r.uPurchasedProp = uPurchasedProp;

        MovingArea p = g.GetComponentInChildren <MovingArea>();

        p.OnMouseDown();

        mProps.Remove(uPurchasedProp);
    }
Ejemplo n.º 2
0
    public void setPosition(GridWorld gridWorld, Position position)
    {
        this.gridWorld       = gridWorld;
        this.monsterPosition = position;
        this.movingArea      = new MovingArea(gridWorld, position, movingAreaWidth, movingAreaHeight);

        // initial its surrounding tiles in the grid world with monsterAtttackCost
        this.toggleCostOfTile(monsterPosition, true);
    }
Ejemplo n.º 3
0
    void OnMouseDown()
    {
        GameObject g = (GameObject)Instantiate(mDialoguePrefab, Vector3.zero, Quaternion.identity);

        g.transform.parent = mScreen.transform;

        Vector2 mousePosition = uImage.GetManager().ScreenToGui(new Vector2(Input.mousePosition.x, Input.mousePosition.y));

        dfSlicedSprite sprite = g.GetComponent <dfSlicedSprite>();
        // TODO: these numbers are hardcoded - copied from the unity gui - figure out how to get this programatically
        Vector2 top_left = new Vector2(mousePosition.x - 183, (0 - mousePosition.y) + 123);

        sprite.Position   = new Vector2(top_left.x - (sprite.Size.x / 2), top_left.y + (sprite.Size.y / 2));
        sprite.SpriteName = uBackgroundSpriteName;
        sprite.Size       = new Vector2(300, 300);

        MovingArea p = g.GetComponentInChildren <MovingArea>();

        p.OnMouseDown();
    }