Exemple #1
0
    void UpdateType()
    {
        //Update Animators if different
        if (previousDroneMode != droneMode)
        {
            UpdateModels();
        }

        //Reset All Values
        attackRange    = orignialAttackRange;
        attackDamage   = orignialAttackDamage;
        agroRange      = orignialAgroRange;
        attackCooldown = orignialAttackCooldown;
        miningRate     = orignialMiningRate;
        mineTime       = orignialMineTime;
        mineMaxInv     = orignialMineMaxInv;
        repairTime     = orignialRepairTime;
        repairAmount   = orignialRepairAmount;
        objID.ResetHealthToOriginal();

        if (droneMode == DroneMode.WORKER)
        {
            canRepair   = true;
            canMine     = true;
            canFight    = true;
            bomber      = false;
            canAttachTo = false;
        }
        else if (droneMode == DroneMode.MINER)
        {
            canRepair   = true;
            canMine     = true;
            canFight    = false;
            bomber      = false;
            canAttachTo = false;

            //Give a 250% boost to mining rate and inv
            miningRate *= 2.5f;
            mineMaxInv  = Mathf.Round(2.5f * mineMaxInv);
        }
        else if (droneMode == DroneMode.FIGHTER)
        {
            canRepair   = false;
            canMine     = false;
            canFight    = true;
            bomber      = false;
            canAttachTo = false;

            //Give a 250% boost to attackDamage and a 15% boost to range
            agroRange    *= 2.5f;
            attackDamage *= 2.5f;
        }
        else if (droneMode == DroneMode.BOOSTER)
        {
            canRepair   = false;
            canMine     = false;
            canFight    = false;
            bomber      = false;
            canAttachTo = true;
        }
        else if (droneMode == DroneMode.BOMBER)
        {
            canRepair   = true;
            canMine     = false;
            canFight    = true;
            bomber      = true;
            canAttachTo = false;

            //Make glass cannon
            attackDamage *= 10.0f;
            objID.ModifyMaxHealth(objID.maxHealth * 0.1f);
        }
        else
        {
            Debug.LogWarning($"Cannot assign correct values as drone mode unknown: {droneMode}");
        }
    }