Пример #1
0
        public CharacterResource GetResource(CharacterResources resource)
        {
            CharacterResource result;

            resources.TryGetValue(resource, out result);
            return(result);
        }
Пример #2
0
 static GameState()
 {
     weapons = new WeaponData[]
     {
         new WeaponData("Pistol", 2)
     };
     characterData = new CharacterData(100, 5, weapons[0]);
     resources     = new CharacterResources(0);
 }
Пример #3
0
        public void SpendResource(CharacterResources resourceKey, long resourceToSpend)
        {
            if (resourceToSpend < 0)
            {
                return;
            }
            CharacterResource resource = GetResource(resourceKey);

            resource.CurrentAmmount -= resourceToSpend;

            if (resource.CurrentAmmount < 0)
            {
                resource.CurrentAmmount = 0;
            }
            Debug.LogFormat("[CharacterResources.SpendResource] Spend resource {0}, ammount to spend: {1}, new current ammount: {2}", resourceKey, resourceToSpend, resource.CurrentAmmount);
        }
Пример #4
0
        public void ReceiveResource(CharacterResources resourceKey, long resourceToReceive)
        {
            if (resourceToReceive < 0)
            {
                return;
            }
            CharacterResource resource = GetResource(resourceKey);

            Debug.LogFormat("[CharacterResources.ReceiveMana] Get resource {0}  ", resourceToReceive);
            resource.CurrentAmmount += resourceToReceive;

            if (resource.CurrentAmmount > resource.MaxAmmount)
            {
                resource.CurrentAmmount = resource.MaxAmmount;
            }
            Debug.LogFormat("[CharacterResources.ReceiveResource] Recieving resource {0}, ammount: {0}, new current ammount: {2}", resourceKey, resourceToReceive, resource.CurrentAmmount);
        }
Пример #5
0
 public ModelCharacter()
 {
     Questcompleted     = new ModelQuestCompleted();
     Questinstances     = new ModelCharacterQuestinstances();
     Activetechs        = new ModelCharacterTechsActive();
     Capitaltechs       = new ModelCharacterTechsCapital();
     Protounits         = new ModelCharacterProtounits();
     Traits             = new ModelCharacterTraits();
     Inventories        = new Inventories();
     Capitallockedtiles = new ModelCharacterCapitallockedtiles();
     Questgivers        = new ModelCharacterQuestgivers();
     Resources          = new CharacterResources();
     Availableadvisors  = new ModelCharacterAdvisorsAvailable();
     Assignedadvisors   = new AdvisorsAssigned();
     Capitalresources   = new CharacterCapitalResources();
     Unitstates         = new CharacterUnitstates();
     Configs            = new CharacterConfigs();
     Craftschools       = new ModelCharacterCraftschools();
     Designslearned     = new ModelCharacterLearneddesigns();
     Vanities           = new ModelCharacterVanities();
     Regionsunlocked    = new ModelCharacterUnlockedRegions();
 }
 public CharacterResource(CharacterResources resource, long currentAmmount, long maxAmmount)
 {
     this.resource       = resource;
     this.maxAmmount     = maxAmmount;
     this.currentAmmount = currentAmmount;
 }
Пример #7
0
 public void RemoveResource(CharacterResources resourceKey)
 {
     resources.Remove(resourceKey);
 }
Пример #8
0
 public void AddResource(CharacterResources resourceKey, CharacterResource resource)
 {
     resources.Add(resourceKey, resource);
 }