Exemplo n.º 1
0
    // Use this for initialization
    protected void Start()
    {
        if (hitInfo == null)
        {
            hitInfo = Resources.Load <GameObject>("Info/HitInfo");
        }
        if (byteObject == null)
        {
            byteObject = Resources.Load <GameObject>("Info/Byte");
        }

        int minversionInt = Utility.ComparableVersionInt(minVersion);
        int maxversionInt = Utility.ComparableVersionInt(maxVersion);
        int minRange      = Mathf.Min(Mathf.Max(minversionInt, Utility.ComparableVersionInt(Player.version) - 10), maxversionInt);
        int maxRange      = Mathf.Max(Mathf.Min(Utility.ComparableVersionInt(Player.version) + 2, maxversionInt), minversionInt);

        int versionInt = (Random.Range(minRange, maxRange) % 100) + 1;

        Debug.Log(this.name + ": versionint = " + versionInt);
        this.maxHP *= (int)((versionInt) * (healthScale + 1));
        Debug.Log(this.name + ": maxhp = " + this.maxHP);
        this.baseAttackDamage += (versionInt) * (attackScale);
        Debug.Log(this.name + ": attack = " + this.baseAttackDamage);
        this.baseHealthRegen += (versionInt) * (healthRegenScale);
        this.baseAttackSpeed /= (versionInt) * (attackSpeedScale + 1);
        this.version          = Utility.ModVersionBy("1.0.0", versionInt);
        Debug.Log(this.name + ": version = " + version);
        hp = maxHP;
        if (possibleItemDrops.Count != possibleItemDropsChance.Count)
        {
            Debug.LogWarning("Hey dummy! You need to have equal number of item drops and item drop chances!");
        }
        else
        {
            for (int i = 0; i < possibleItemDrops.Count; i++)
            {
                itemDrops.Add(possibleItemDrops[i], possibleItemDropsChance[i]);
            }
        }

        currentEffect = Effect.None;

        PlayerCanvas.RegisterEnemyHealthBar(this.gameObject);

        speedRandomness = Random.value * 5f;
    }