Beispiel #1
0
    public void ListenForItemPickedUp(GameObject obj, TrapPiece trapPiece)
    {
        //Make sure hand is empty
        if (this.objInMyHand == null)
        {
            //-----------------------------TODO remove-------------------------
            obj.transform.position = new Vector3(0, 10, 0);

            this.objInMyHand = obj;
            this.trapPiece   = trapPiece;

            //Spawn ghost obj
            SpawnObjGrabbed(trapPiece.currentType);

            if (!trapPiece.itemWasPlacedOnMap)
            {
                //Check if item was pickup from shop or map
                if (!trapPiece.itemWasPlacedOnMap)
                {
                    //Respawn the right obj
                    SpawnTheRightObj(trapPiece);
                }
            }
        }
    }
Beispiel #2
0
    private void PlaceObjBackWhereItWas(GameObject obj, TrapPiece trapPiece)
    {
        //Get old position
        Vector3 position = this.gridManager.GetGrid("MapRoom").GetCenterTileFromCoords(trapPiece.positionOnMap);

        //Set position to item in my hand
        this.objInMyHand.transform.position = position;

        //Remove ghost item
        RemoveObjWithAnimation(obj);
    }
Beispiel #3
0
    public void ListenForItemDropped(GameObject obj, TrapPiece trapPiece)
    {
        //TODO implement real inputs
        if (Input.GetButtonDown("Jump"))
        {
            if (trapPiece.itemWasPlacedOnMap)
            {
                //Place back to where it was
                PlaceObjBackWhereItWas(this.objInMyHand, trapPiece);
            }
            else
            {
                //Remove from map
                RemoveObjWithAnimation(this.objSelected);

                this.objInMyHand = null;
                this.objSelected = null;
                this.trapPiece   = null;
            }
        }
    }
Beispiel #4
0
 private void SpawnTheRightObj(TrapPiece trapPiece)
 {
     this.timeManager.AddTimedAction(new TimedAction(() => { SpawnTrapInShop(trapPiece.currentType); }, 3f));
 }