/**
     * Sets the values of a new controller.
     * Adds weapons from the list provided.
     *
     * @param values
     *      A json friendly version of a dictionary with the default
     *      values for the attack controller
     */
    public override void SetValues(IDictionary values)
    {
        IList WeaponList = (IList)values["weapons"];

        Weapons.Clear();
        foreach (IDictionary IWeapon in WeaponList)
        {
            string name    = (string)IWeapon["name"];
            string wepType = (string)IWeapon["type"];
            string Key     = GenerateKey(name);
            //TODO add correct amounts of maxshots and maxshots per turn
            float range     = Convert.ToSingle(IWeapon["range"]);
            float lethality = Convert.ToSingle(IWeapon["lethality"]);
            float probHit   = Convert.ToSingle(IWeapon["prob_of_hit"]);
            // probably string
            int count   = Convert.ToInt32(IWeapon["count"]);
            int curammo = (IWeapon.Contains("curammo") ? Convert.ToInt32(IWeapon["curammo"]) : count);
            int maxRate = Convert.ToInt32(IWeapon["max_rate"]);

            Weapon NewWeapon;

            if (IWeapon.Contains("targets"))
            {
                IDictionary idict             = (IDictionary)IWeapon["targets"];
                Dictionary <string, int> temp = new Dictionary <string, int>();
                foreach (object key in idict.Keys)
                {
                    temp.Add(key.ToString(), Convert.ToInt32(idict[key]));
                }
                Dictionary <string, int> targets = temp;
                NewWeapon = new Weapon(wepType, range, lethality, probHit, count, curammo, maxRate, targets);
            }
            else
            {
                NewWeapon = new Weapon(wepType, range, lethality, probHit, count, curammo, maxRate);
            }

            NewWeapon.Name = name;
            Weapons.Add(Key, NewWeapon);

            // Set the owner for the new weapon
            NewWeapon.SetOwner((this.gameObject.GetComponent <IdentityController>()).GetGuid(), Key);
        }
    }