Example #1
0
 public void onPickUp(s_Player p)
 {
     if (p.SetEquippedWeapon(this)) // checks to make the weapon is not one just dropped if it is not then it equips it and continues
     {
         AudioControlerScript.PlaySound(AudioControlerScript.Clips.pickup_gun_001);
         SetHolder(p);
         p.AddWeaponToHand(this);
         holderColor = p.PlayerColor;
         tossed      = null;
         p.PlayPickupSound();
         doPickUpEffect();
     }
 }
Example #2
0
 public void Dropped(bool died)
 {
     if (died == false)
     {
         Vector3    targetPos = transform.position + (holder.GetAimDirection() * -4);
         RaycastHit hit;
         if (Physics.Raycast(targetPos, Vector3.down, out hit, Physics.AllLayers))
         {
             targetPos.y = hit.point.y + 0.1f;
         }
         tossed = new TossStruct(transform.position, targetPos, 14);
     }
     holderColor = Color.white;
     SetHolder(null);
     transform.SetParent(null);
     transform.eulerAngles = Vector3.zero;
     revertMesh();
 }
Example #3
0
    protected virtual void onUpdate()
    {
        if (s_GameManager.GetPaused())
        {
            return;
        }


        if (holder != null && holder.GetEquippedWeapon() != this)
        {
            Dropped(false);
        }



        if (tossed != null)
        {
            bool hitLocation;
            transform.position = tossed.Move(out hitLocation);
            if (hitLocation)
            {
                tossed = null;

                RaycastHit hit;
                if (Physics.Raycast(transform.position, Vector3.down, out hit, 30, Physics.AllLayers, QueryTriggerInteraction.Ignore))
                {
                    if (hit.distance > 1.5f)
                    {
                        tossed = new TossStruct(transform.position, hit.point + new Vector3(0, 1, 0), 14, true);
                    }
                }

                checkIfEmpty();
            }
        }
    }