Beispiel #1
0
    /// <summary>
    /// The player has stolen a weapon with the photon weapon
    /// </summary>
    public void SuccessfulWeaponSteal(Whip_PhotonWhip whipUsed)
    {
        detachedWeapon = mechComponent.leftWeapon;
        playerHUD.SetWhipRecharge(whipUsed.stealCoolDown);

        // Check for life steal upgrade
        float lifeStealAmount = GetLifeSteal();
        if(lifeStealAmount > 0.0f) {
            mechComponent.AddHealth(lifeStealAmount, gameObject);
        }
    }
Beispiel #2
0
    public override void NewWeaponAttached(Weapon attached)
    {
        base.NewWeaponAttached(attached);

        attached.ResetRefireDelay();

        // Cache ref to photon whip when it is attached (on spawn usually)
        if(attached != null && attached.GetType() == typeof(Whip_PhotonWhip)) {
            whipAttachment = (Whip_PhotonWhip)attached;
            Debug.Log("Player has photon whip attachment");
        }

        // check if the weapon wants a laser sight or not
        if(attached != null && attached.GetType() != typeof(Whip_PhotonWhip)) {
            if(attached.hasLaserSight && laserSightRenderer != null) {
                laserSightRenderer.enabled = true;
            }
            else if(laserSightRenderer != null) {
                laserSightRenderer.enabled = false;
            }
        }

        // update the hud images
        if(playerHUD != null && playerHUD.equippedWeaponElement != null) {
            Sprite weaponSprite = attached.GetWeaponSprite(); ;
            playerHUD.equippedWeaponElement.sprite = weaponSprite;
            playerHUD.equippedWeaponElement.enabled = weaponSprite != null? true : false;
        }
        if(playerHUD != null && playerHUD.damageTypeElement != null) {
            playerHUD.SetDamageTypeDisplay(attached.damageTypeList);
        }

        // if there was a detached eapon, to attach this one, then swap it into the seconrady slot if there is nothing there
        if(backupWeapon == null && detachedWeapon != null) {
            // need to bring the detatched weapon back fromn the dead
            detachedWeapon.transform.SetParent(mechComponent.leftAttachPoint);
            detachedWeapon.gameObject.SetActive(true);
            detachedWeapon.GetRenderer().enabled = false;

            // cahche the weapon
            backupWeapon = detachedWeapon;

            // and update hud
            playerHUD.secondarydWeaponElement.enabled = true;
            playerHUD.secondarydWeaponElement.sprite = backupWeapon.GetWeaponSprite();
        }

        // Send a message to the HUD to display on screen
        if(playerHUD != null) {
            playerHUD.DoOnScreenAnnouncement(attached.weaponName);
        }

        detachedWeapon = null;
    }