Exemplo n.º 1
0
    public void EquipEquipment(GameItem itm, EquipmentType type)
    {
        switch (type)
        {
        case EquipmentType.LeftArm:
            _leftArm     = itm;
            _specials[0] = itm.special;

            break;

        case EquipmentType.RightArm:
            _rightArm    = itm;
            _specials[1] = itm.special;

            break;

        case EquipmentType.LeftLeg:
            _leftLeg     = itm;
            _specials[2] = itm.special;

            break;

        case EquipmentType.RightLeg:
            _rightLeg    = itm;
            _specials[3] = itm.special;

            break;
        }

        GlobalItens.RemoveFromInventory(itm);

        UpdateAttributesEquipment();
    }
Exemplo n.º 2
0
 void OnMouseDown()
 {
     if (_invController.itemSelected != null)
     {
         GlobalItens.RemoveFromInventory(_invController.getItemSelected());
         _invController.UpdateItemList();
     }
 }
Exemplo n.º 3
0
 public void RemoveEquippedItem(GameItem itm, int pos)
 {
     if (_itens[pos] != null && _itens[pos] == itm)
     {
         GlobalItens.AddToInventory(_itens[pos]);
         _itens[pos] = null;
     }
 }
Exemplo n.º 4
0
 public bool EquipItem(GameItem itm)
 {
     for (int i = 0; i < 4; i++)
     {
         if (_itens[i] == null)
         {
             _itens[i] = itm;
             GlobalItens.RemoveFromInventory(itm);
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 5
0
    public static GameCharacter generetaChar()
    {
        GameCharacter _char = new GameCharacter();

        _char.baseAttr.SetAttributes(10, 10, 10, 10, 10, 100, 1000);
        _char.baseAttr.SetTimers(10, 20, 5, 10);
        _char.sprite = Random.Range(1, 5);

        _char.itens.SetValue(GlobalItens.generateAlchemy(AlchemyType.HealLife), 0);
        _char.itens.SetValue(GlobalItens.generateAlchemy(AlchemyType.HealLife), 1);
        _char.itens.SetValue(GlobalItens.generateAlchemy(AlchemyType.HealLife), 2);
        _char.itens.SetValue(GlobalItens.generateAlchemy(AlchemyType.HealLife), 3);

        return(_char);
    }
Exemplo n.º 6
0
    void OnMouseDown()
    {
        GameItem itm = (_charController.GetComponent <WindowCharacterController>().currentItemSelected);

        if (GlobalItens.isInInventory(itm))
        {
            switch (itm.type)
            {
            case ItemType.Alchemy:
                GlobalCharacter.player.EquipItem(itm);
                break;

            case ItemType.Equipment:
                GlobalCharacter.player.EquipEquipment(itm, itm.equipmentType);
                break;
            }
        }
        _charController.GetComponent <WindowCharacterController>().HideListToEquip();
        _charController.GetComponent <WindowCharacterController>().OpenChangeItem(false);
        Camera.main.GetComponent <InventoryController>().UpdateCharacter();
    }
Exemplo n.º 7
0
    void Start()
    {
        GlobalItens.Init();
        GlobalCharacter.Init();
        GlobalWorldMap.Init();
        GlobalQuests.Init();
        GlobalMap.Init();
        GlobalInput.Init();

        _itens = new ArrayList();
        _npcs  = new ArrayList();

        AddItemToMap(GlobalItens.generateAlchemy(AlchemyType.HealLife), new Vector3(64, 96, -5));


        GameCharacter test = GlobalCharacter.generetaChar();

        test.name   = "ERRROR";
        test.sprite = 5;

        AddCharacterToMap(test, new Vector3(32, 32, -10));
    }
Exemplo n.º 8
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();
    }
Exemplo n.º 9
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;
        }
    }
Exemplo n.º 10
0
 void Start()
 {
     GlobalCharacter.Init();
     GlobalItens.Init();
 }
Exemplo n.º 11
0
 void Start()
 {
     _item = GlobalItens.generateAlchemy(AlchemyType.HealLife);
     this.GetComponent <TileChanges>().changeTile(_item.sprite);
 }