Beispiel #1
0
 public void OnWorldSpawn()
 {
     worldSpawned = true;
     if (PowerupManager.GetPowerupStatus(Powerups.ExtraAmmo))
     {
         ammo += ammo;
     }
 }
Beispiel #2
0
    public void Start()
    {
        hp           = GetComponentInParent <Health>();
        hp.OnDamage += OnDamage;

        if (PowerupManager.GetPowerupStatus(Powerups.StrongHealthPacks))
        {
            healAmount += healAmount;
        }

        OnTakeOut += TakingOut;
    }
    // Update is called once per frame
    void FixedUpdate()
    {
        PlayerInputClass inputState = manager.PlayerInputState;

        HealingGun.ammunition.UpdateHealthPackAmmo();

        if (inputState != null)
        {
            if (inputState.Switch)
            {
                if (HealingGun.gameObject.activeSelf)
                {
                    HealingGun.Shoot();
                }
                else if (!switchingWeapons)
                {
                    SwitchWeapon();
                }
            }

            if (inputState.Swap)
            {
                WeaponPickup p = manager.GetPickup();
                if (!HealingGun.gameObject.activeSelf && p != null)
                {
                    int c = p.AmmoInClip;
                    int a = p.ammo;
                    Debug.Log("Swapping: (" + c.ToString() + "," + a.ToString() + ")");

                    if (p.nonreloadable && p.worldSpawned && PowerupManager.GetPowerupStatus(Powerups.ExtraAmmo))
                    {
                        c += Mathf.CeilToInt((float)c / 4);
                    }

                    bool taken = SwapWeapon(p.weaponType, p.transform, a, c);
                    if (taken)
                    {
                        p.TakePickup();
                    }
                }
            }

            if (inputState.Heal && HealingGun.ammunition.remainingAmmo > 0 && playerHealth.currentHealth < playerHealth.maxHealth - 1)
            {
                if (!switchingWeapons)
                {
                    SwitchWeapon(HealingGun, GetCurrentWeapon());
                }
            }
        }
    }
    public static void ResetCash()
    {
        if (CashManager.CashSystem != null)
        {
            if (PowerupManager.GetPowerupStatus(Powerups.Investment))
            {
                CashManager.CashSystem.cash = PowerupManager.PowerupSystem.investmentBuffer;
                PowerupManager.PowerupSystem.investmentBuffer = 0;
                return;
            }

            CashManager.CashSystem.cash = 0;
        }
    }
Beispiel #5
0
    public override void SetAmmo(int ammo)
    {
        if (PowerupManager.GetPowerupStatus(Powerups.ExtendedMag))
        {
            clipSize += Mathf.FloorToInt((float)clipSize / 2);;
        }

        if (ammo == -1)
        {
            ammoInClip = clipSize;
        }
        else
        {
            ammoInClip = ammo;
        }
    }
    public static void AddCash(int amount)
    {
        if (PowerupManager.GetPowerupStatus(Powerups.Multiplier))
        {
            amount = Mathf.RoundToInt(amount * 1.5f);
        }

        amount *= Multiplier;

        if (CashManager.CashSystem != null)
        {
            CashManager.CashSystem.cash += amount;

            if (CashManager.OnGainScore != null)
            {
                CashManager.OnGainScore(amount);
            }
        }
    }
Beispiel #7
0
    protected override IEnumerator TakeOutSequence()
    {
        gunLocked    = true;
        switchedBack = false;
        //failSafeStamp = Time.time + takeOutTime + healTime + 0.2f;
        //failSafe = true;

        putAwayAnimations.ResetPosition();

        if (!PowerupManager.GetPowerupStatus(Powerups.MobileHealthPacks))
        {
            movement.speed = moveSpeed;
        }
        anim.SetTrigger("Play");

        if (OnTakeOut != null)
        {
            OnTakeOut();
        }

        yield return(new WaitForSeconds(takeOutTime));

        isReady = true;

        yield return(new WaitForSeconds(healTime));

        movement.speed = originalPlayerSpeed;
        TakeAmmo(1);
        Health hp = GetComponentInParent <Health>();

        if (hp != null)
        {
            if (OnHeal != null)
            {
                OnHeal(hp.currentHealth / hp.maxHealth);
            }

            hp.AddHealth(healAmount);
        }

        SoundFXPlayer.SFX.PlaySound(healSound);
        Shoot();
    }
Beispiel #8
0
    void Start()
    {
        if (startingWeapon)
        {
            if (PowerupManager.GetPowerupStatus(Powerups.ExtendedMag))
            {
                clipSize  += Mathf.FloorToInt((float)clipSize / 2);
                ammoInClip = clipSize;
            }
            if (PowerupManager.GetPowerupStatus(Powerups.ExtraAmmo))
            {
                ammunition.SetAmmo(120);
            }
        }

        lastTakeOutTime = Time.time;
        if (ImpactFX != null)
        {
            OnHit += SpawnEffect;
        }
        currentConeSize = coneRange.x;
    }
    // Start is called before the first frame update
    void Start()
    {
        if (weapons[1] != null)
        {
            weapons[1].gameObject.SetActive(false);
        }
        weapons[0].gameObject.SetActive(true);
        weapons[0].TakeOutWeapon();

        playerHealth = GetComponentInParent <PlayerHealth>();

        PlayerManager.OnNearPickup += OnNearPickup;

        if (PowerupManager.GetPowerupStatus(Powerups.MaxHealthPacks))
        {
            HealingGun.ammunition.SetAmmo(3);
        }
        else
        {
            HealingGun.ammunition.SetAmmo(0);
        }
    }
    // Update is called once per frame
    void Update()
    {
        UpdateHealthBar();

        if (Time.time > grenadeSwitchOff && grenadeIcon.activeSelf)
        {
            grenadeIcon.SetActive(false);
        }

        if (levelClear)
        {
            int continueValue = PowerupManager.GetPowerupStatus(Powerups.Investment)? CashManager.Cash : 0;
            Debug.Log("Player has $" + continueValue);
            curSecondaryCash = Mathf.RoundToInt(Mathf.Lerp(curSecondaryCash, continuing? continueValue : CashManager.Cash, 12 * Time.deltaTime));

            if (continuing)
            {
                if (Mathf.Abs(curSecondaryCash - continueValue) < 4)
                {
                    curSecondaryCash = continueValue;
                }
            }
            else
            {
                if (Mathf.Abs(curSecondaryCash - CashManager.Cash) < 4)
                {
                    curSecondaryCash = CashManager.Cash;
                }
            }

            secondaryCashText.text = "$" + curSecondaryCash.ToString();
        }
        else
        {
            cashText.text = "$" + CashManager.Cash.ToString();
        }
    }