Ejemplo n.º 1
0
    //Dealing with the player stat dictionary
    public int getStat(string resourceName)
    {
        if (!ShipResources.ContainsKey(resourceName))
        {
            ShipResources.Add(resourceName, 0);
        }

        //returns the value of the given stat
        return(ShipResources[resourceName]);
    }
Ejemplo n.º 2
0
 public void setStat(string resourceName, int Value)
 {
     if (ShipResources.ContainsKey(resourceName))
     {
         ShipResources[resourceName] = Value;
     }
     else
     {
         //If the stat doesnt exist and we are setting it, lets just create it
         ShipResources.Add(resourceName, Value);
     }
     //
 }
Ejemplo n.º 3
0
 public void changeStat(string resourceName, int statChange)
 {
     if (ShipResources.ContainsKey(resourceName))
     {
         ShipResources[resourceName] = getStat(resourceName) + statChange;
         if (ShipResources[resourceName] < 0)
         {
             ShipResources[resourceName] = 0;
         }
     }
     else
     {
         //If the stat doesnt exist and we are setting it, lets just create it
         ShipResources.Add(resourceName, statChange);
     }
     //
 }