Example #1
0
    public void FTryToThrowGrenade(Vector3 msPos)
    {
        msPos.z = 0f;
        if (Time.time - mGunD.mLastFireTmStmp > mGunD._fireInterval)
        {
            mGunD.mLastFireTmStmp = Time.time;
            PJ_PC_FGren p    = Instantiate(PF_Grenade, transform.position, transform.rotation);
            Vector3     vDif = msPos - transform.position;
            vDif = Vector3.Normalize(vDif);
            p.cRigid.velocity = vDif * p.mGrenD._spdInAir;
            p.mGrenD.mState   = GrenadeData.STATE.IN_AIR;
            p.mGrenD.vDest    = msPos;

            // we own the grenades, the explosion can still hurt us.
            p.GetComponent <PJ_Base>().mProjD.rOwner = gameObject;
        }
    }
Example #2
0
 public void FHandleHitObj()
 {
     if (_TYPE == GRENADE_TYPE.PLASMA)
     {
         PJ_EN_PGrenade p = GetComponent <PJ_EN_PGrenade>();
         if (p == null)
         {
             Debug.Log("Grenade is null, maybe wrong type?");
             return;
         }
         p.FEnter_Landed();
     }
     else if (_TYPE == GRENADE_TYPE.FRAG)
     {
         // bounce around a little, but maybe just actually stop or something.
         PJ_PC_FGren p = GetComponent <PJ_PC_FGren>();
         if (p == null)
         {
             Debug.Log("Grenade null, maybe wrong type?");
             return;
         }
         p.FEnter_Landed();
     }
 }