Exemple #1
0
 void BeingToss(TossParameter tP)
 {
     if (ChangeToLayerAfterTossing != string.Empty)
     {
         foreach (Rigidbody rigi in this.GetComponentsInChildren<Rigidbody>())
         {
             rigi.gameObject.layer = LayerMask.NameToLayer(ChangeToLayerAfterTossing);
         }
     }
     TosseeTransformAnchor.AddForce(tP.forceDirection * tP.Force, ForceMode.Impulse);
     foreach (MonoBehaviour mono in StopMonoWhenTossed)
     {
         Destroy(mono);
     }
 }
Exemple #2
0
 void BeingToss(TossParameter tP)
 {
     if (ChangeToLayerAfterTossing != string.Empty)
     {
         foreach (Rigidbody rigi in this.GetComponentsInChildren <Rigidbody>())
         {
             rigi.gameObject.layer = LayerMask.NameToLayer(ChangeToLayerAfterTossing);
         }
     }
     TosseeTransformAnchor.AddForce(tP.forceDirection * tP.Force, ForceMode.Impulse);
     foreach (MonoBehaviour mono in StopMonoWhenTossed)
     {
         Destroy(mono);
     }
 }
    IEnumerator Toss()
    {
        //Debug.Break();
        //Avoid frequent invoking
        if ((PredatorPlayerStatus.IsAttacking == true) ||
            (HasFetchSomething == false || currentFetchedObject == null))
        {
            yield break;
        }
        else
        {
            float TossTimePoint = (float)2 / (float)30;
            animation.CrossFade(TossAnimation);
            yield return(new WaitForSeconds(TossTimePoint));

            float         tossForce = PunctureTossPower;
            TossParameter tP        = new TossParameter(this.gameObject, currentFetchedObject, tossForce, transform.forward);
            currentFetchedObject.SendMessage("BeingToss", tP);
            HasFetchSomething    = false;
            currentFetchedObject = null;
        }
        yield return(null);
    }
 IEnumerator Toss()
 {
     //Debug.Break();
     //Avoid frequent invoking
     if ((PredatorPlayerStatus.IsAttacking == true) ||
         (HasFetchSomething == false || currentFetchedObject == null))
     {
         yield break;
     }
     else
     {
         float TossTimePoint = (float)2 / (float)30;
         animation.CrossFade(TossAnimation);
         yield return new WaitForSeconds(TossTimePoint);
         float tossForce = PunctureTossPower;
         TossParameter tP = new TossParameter(this.gameObject, currentFetchedObject, tossForce, transform.forward);
         currentFetchedObject.SendMessage("BeingToss", tP);
         HasFetchSomething = false;
         currentFetchedObject = null;
     }
     yield return null;
 }