Esempio n. 1
0
    public bool Gift(string itemId, string npcId)
    {
        if (!ReferenceEquals(_npcsController, null))
        {
            if (_npcsController.NpcsDic.ContainsKey(npcId))
            {
                Npc    npc     = _npcsController.NpcsDic[npcId];
                Sprite icon    = npc.Icon;
                string nameNpc = npc.NpcName;
                if (npc.CanGift())
                {
                    FeelNpc feelNpc = FeelNpc.Normal;
                    string  favId   = npc.FavoriteItemSetId;
                    float   charm   = playerAction.GetTotalBonusCharm();
                    if (_npcsController.FavoriteItemsDic.ContainsKey(favId))
                    {
                        FavoriteItems_Template favoriteItems_Template          = _npcsController.FavoriteItemsDic[favId];
                        Dictionary <string, DialogueFavoriteItem> ItemLikeId   = new Dictionary <string, DialogueFavoriteItem>();
                        Dictionary <string, DialogueFavoriteItem> ItemUnlikeId = new Dictionary <string, DialogueFavoriteItem>();
                        Dictionary <string, DialogueFavoriteItem> ItemExceptId = new Dictionary <string, DialogueFavoriteItem>();
                        ItemLikeId   = favoriteItems_Template.ItemLikeId;
                        ItemUnlikeId = favoriteItems_Template.ItemUnLikeId;
                        ItemExceptId = favoriteItems_Template.ItemExceptId;

                        if (ItemLikeId.ContainsKey(itemId))
                        {
                            //like
                            npc.IncreaseRelationship((int)(playerAction.GetTotalBonusCharm() * INST_VALUE_FAVORITE_LIKE + 0.5f));
                            feelNpc = FeelNpc.Like;
                        }
                        else if (ItemUnlikeId.ContainsKey(itemId))
                        {
                            //unlike
                            npc.DecreaseRelationship(INST_VALUE_FAVORITE_UnLIKE);
                            feelNpc = FeelNpc.Unlike;
                        }
                        else if (ItemExceptId.ContainsKey(itemId))
                        {
                            //except
                            npc.IncreaseRelationship((int)(playerAction.GetTotalBonusCharm() * INST_VALUE_FAVORITE_EXCEPT + 0.5f));
                            feelNpc = FeelNpc.Except;
                        }
                        else
                        {
                            //normal
                            npc.IncreaseRelationship((int)(playerAction.GetTotalBonusCharm() * INST_VALUE_FAVORITE_NORMAL + 0.5f));
                        }
                    }
                    else
                    {
                        //normal
                        npc.IncreaseRelationship((int)(playerAction.GetTotalBonusCharm() * INST_VALUE_FAVORITE_NORMAL + 0.5f));
                    }

                    npc.CountGift();

                    //notification NPC's feeling
                    switch (feelNpc)
                    {
                    case FeelNpc.Normal:
                        _notificationController.Emotion(_normal);
                        break;

                    case FeelNpc.Like:
                        _notificationController.Emotion(_like);
                        break;

                    case FeelNpc.Unlike:
                        _notificationController.Emotion(_unlike);
                        break;

                    case FeelNpc.Except:
                        _notificationController.Emotion(_except);
                        break;
                    }
                    _characterStatusController.IncreaseCurrentMotivation(INST_VALUE_MOTIVATION);
                    return(true);
                }
                else
                {
                    //notification
                    _notificationController.LimitGift(icon, nameNpc);
                    return(false);
                }
            }
        }
        return(false);
    }
Esempio n. 2
0
    public void UseItem()
    {
        List <ItemPropertyAmount> properties = new List <ItemPropertyAmount>();

        properties = itemDefinition.ItemProperties;
        int count = properties.Count;

        if (count > 0)
        {
            for (int i = 0; i < count; i++)
            {
                ItemPropertyType type  = properties[i].PropertyType;
                float            value = properties[i].Amount;
                switch (type)
                {
                case ItemPropertyType.Energy:
                    characterStatusController.IncreaseCurrentEnergy(value);
                    break;

                case ItemPropertyType.Motivation:
                    characterStatusController.IncreaseCurrentMotivation(value);
                    break;

                case ItemPropertyType.StatusPoint:
                    characterStatusController.IncreaseStatusPoints((int)value);
                    break;

                case ItemPropertyType.SoftSkillPoint:
                    characterStatusController.IncreaseSoftSkillPoints((int)value);
                    break;

                case ItemPropertyType.CharacterExp:
                    characterStatusController.IncreaseEXP((int)value);
                    break;

                case ItemPropertyType.HSMathExp:
                    hardSkillsController.IncreaseEXP(hardSkillsController.INST_Math_Id, (int)value);
                    break;

                case ItemPropertyType.HSProgramingExp:
                    hardSkillsController.IncreaseEXP(hardSkillsController.INST_Programming_Id, (int)value);
                    break;

                case ItemPropertyType.HSEngineExp:
                    hardSkillsController.IncreaseEXP(hardSkillsController.INST_Engine_Id, (int)value);
                    break;

                case ItemPropertyType.HSNetworkExp:
                    hardSkillsController.IncreaseEXP(hardSkillsController.INST_Network_Id, (int)value);
                    break;

                case ItemPropertyType.HSAiExp:
                    hardSkillsController.IncreaseEXP(hardSkillsController.INST_Ai_Id, (int)value);
                    break;

                case ItemPropertyType.HSDesignExp:
                    hardSkillsController.IncreaseEXP(hardSkillsController.INST_Design_Id, (int)value);
                    break;

                case ItemPropertyType.HSTesting:
                    hardSkillsController.IncreaseEXP(hardSkillsController.INST_Testing_Id, (int)value);
                    break;

                case ItemPropertyType.HSArtExp:
                    hardSkillsController.IncreaseEXP(hardSkillsController.INST_Art_Id, (int)value);
                    break;

                case ItemPropertyType.HSSoundExp:
                    hardSkillsController.IncreaseEXP(hardSkillsController.INST_Sound_Id, (int)value);
                    break;
                }
            }
        }
        DestroyItemPickUp();
    }