コード例 #1
0
 public void RemoveEquippedItem(GameItem itm, int pos)
 {
     if (_itens[pos] != null && _itens[pos] == itm)
     {
         GlobalItens.AddToInventory(_itens[pos]);
         _itens[pos] = null;
     }
 }
コード例 #2
0
    public void RemoveEquippedEquipment(EquipmentType pos)
    {
        switch (pos)
        {
        case EquipmentType.LeftArm:

            GlobalItens.AddToInventory(_leftArm);
            _leftArm     = null;
            _specials[0] = null;

            break;

        case EquipmentType.RightArm:

            GlobalItens.AddToInventory(_rightArm);
            _rightArm    = null;
            _specials[1] = null;

            break;

        case EquipmentType.LeftLeg:

            GlobalItens.AddToInventory(_leftLeg);
            _leftLeg     = null;
            _specials[2] = null;

            break;

        case EquipmentType.RightLeg:

            GlobalItens.AddToInventory(_rightLeg);
            _rightLeg    = null;
            _specials[3] = null;

            break;
        }
        UpdateAttributesEquipment();
    }
コード例 #3
0
    public void ClickAction(GameObject other = null)
    {
        switch (_actionType)
        {
        case ActionTileType.ChangeSpriteToNotCollide:
        case ActionTileType.ChangeSpriteToCollide:

            if (oldSprite == 0)
            {
                oldSprite = this.gameObject.GetComponent <TileChanges>().TileNumber;
                this.gameObject.GetComponent <TileChanges>().changeTile((int)(actionValue));
            }
            else
            {
                this.gameObject.GetComponent <TileChanges>().changeTile(oldSprite);
                oldSprite = 0;
            }
            this.gameObject.GetComponent <TileChanges>().updateCollision(_spriteCollision);

            break;

        case ActionTileType.PickupItem:

            GlobalItens.AddToInventory(this.GetComponent <ItemBase>().item);
            Destroy(this.gameObject);

            break;

        case ActionTileType.GotoLocation:

            int[] val = (int[])(actionValue);
            Debug.Log("gotolocation");
            other.transform.position = new Vector3(16 * val[0], 16 * val[1], other.transform.position.z);

            break;
        }
    }