示例#1
0
    private void HandleOrbs(bool hasEnoughEnergy)
    {
        if (TP_Utilities.GetAction("SpawnOrbs", KeybindingsProfile.Instance))
        {
            if (hasEnoughEnergy)
            {
                float orbCount = 3;
                float angle    = 0;

                for (int i = 0; i < 3; i++)
                {
                    float posX = Mathf.Cos(angle * Mathf.Deg2Rad);
                    float posZ = Mathf.Sin(angle * Mathf.Deg2Rad);
                    angle += 360 / orbCount;

                    Vector3 offsetDir  = transform.right * posX + transform.forward * posZ;
                    Vector3 spawnPoint = transform.position + offsetDir * 1.3f;

                    Transform orb = Instantiate(orbPrefab, spawnPoint, Quaternion.identity).transform;

                    orb.LookAt(transform.position);
                }
            }
        }
    }
示例#2
0
    private void HandleEnergyShield(bool hasEnoughEnergy)
    {
        if (TP_Utilities.GetAction("ActivateShield", KeybindingsProfile.Instance))
        {
            if (hasEnoughEnergy)
            {
                if (shieldCooldownTimer == 0)
                {
                    energyShieldObject.SetActive(true);
                    isShielded = true;
                }
            }
        }

        if (TP_Utilities.GetAction("DeactivateShield", KeybindingsProfile.Instance))
        {
            if (isShielded)
            {
                energyRegenTimer    = Time.time + 0.3f;
                shieldCooldownTimer = abilityStats.shieldCooldownTime;
                isShielded          = false;
            }
        }

        if (isShielded)
        {
            energyShieldObject.transform.localScale = Vector3.Lerp(energyShieldObject.transform.localScale, Vector3.one, Time.deltaTime * 10f);

            currentEnergy -= Time.deltaTime * abilityStats.shieldMaintenanceEnergyConsumption;
            currentEnergy  = Mathf.Clamp(currentEnergy, 0f, maxEnergy);

            if (currentEnergy == 0)
            {
                energyRegenTimer    = Time.time + 0.6f;
                shieldCooldownTimer = abilityStats.shieldCooldownTime;
                isShielded          = false;
            }
        }

        else
        {
            energyShieldObject.transform.localScale = Vector3.Lerp(energyShieldObject.transform.localScale, Vector3.one * 0.5f, Time.deltaTime * 10f);
            if (energyShieldObject.transform.localScale.x < 0.58f)
            {
                energyShieldObject.SetActive(false);
            }
        }
    }
示例#3
0
    private void HandleDash(bool hasEnoughEnergy)
    {
        if (TP_Utilities.GetAction("Dash", KeybindingsProfile.Instance))
        {
            if (hasEnoughEnergy)
            {
                if (dashCooldownTimer == 0)
                {
                    if (!isShielded)
                    {
                        TP_Motor.Instance.BeginDash(abilityStats.dashLength, abilityStats.dashIFrameDuration);
                        currentEnergy -= abilityStats.dashEnergyConsumption;

                        dashCooldownTimer = abilityStats.dashCooldownTime;
                        energyRegenTimer  = Time.time + abilityStats.dashLength + 0.3f;
                    }
                }
            }
        }
    }