Esempio n. 1
0
 public void AddDataAddon(string addonClass, BaseDataAddon addon)
 {
     if (!DataObjects.ContainsKey(addonClass))
     {
         DataObjects.Add(addonClass, addon);
     }
 }
Esempio n. 2
0
 public BaseDataAddon(BaseDataAddon klonujZTego)
 {
     _attribs = new Dictionary <string, object>();
     foreach (string attrName in klonujZTego._attribs.Keys)
     {
         _attribs.Add(attrName, klonujZTego[attrName]);
     }
     Type = klonujZTego.Type;
 }
Esempio n. 3
0
        private float RangeModfier(BaseDataAddon weaponData, GameObject hited)
        {
            float distance = (hited.transform.position - gameObject.transform.position).magnitude;

            if (distance <= 0.5f * (float)weaponData["shootRange"])
            {
                return(1);
            }
            if (distance <= (float)weaponData["shootRange"])
            {
                return(1 - distance / (float)weaponData["shootRange"]);
            }
            return(0);
        }
Esempio n. 4
0
        private float CalculateHitAmmount(BaseDataAddon weaponData, SceneDestructible hited)
        {
            float amnt = 0;

            if ((int)weaponData["meleeMin"] > 0 && (int)weaponData["meleeMax"] > 0 && (int)weaponData["meleeMin"] <= (int)weaponData["meleeMax"])
            {
                amnt = Random.Range((int)weaponData["meleeMin"], (int)weaponData["meleeMax"]);
            }
            else
            if ((int)weaponData["shootMin"] > 0 && (int)weaponData["shootMax"] > 0 && (int)weaponData["shootMin"] <= (int)weaponData["shootMax"])
            {
                amnt = Random.Range((int)weaponData["shootMin"], (int)weaponData["shootMax"]) * RangeModfier(weaponData, GameManager.Instance.ThePlayerController.gameObject);
            }

            if ((int)weaponData["critical"] > 0 && Random.Range(0, 100) < (int)weaponData["critical"])
            {
                amnt *= CRITICAL_BONUS;
            }
            if (hited != null && hited.DestructibleData["hitType"] != null && weaponData[(string)hited.DestructibleData["hitType"] + "Bonus"] != null)
            {
                amnt += (amnt * (int)weaponData[(string)hited.DestructibleData["hitType"] + "Bonus"]) / 100;
            }
            return(amnt);
        }