Esempio n. 1
0
 void AutoReverse(ReverseMovement MyReverseMovement)
 {
     if (CanTimeBeReversed)
     {
         float AutoReverseTime = -1;
         if (AutoReverseTime == -1)
         {
             AutoReverseTime = MyReverseMovement.MutateReverseTime();
         }
         else
         {
             MyReverseMovement.SetAutoReverseTime(AutoReverseTime);
         }
     }
 }
Esempio n. 2
0
 // this happens on all parts, need it to just happen on some!
 public void AwakenBody()
 {
     for (int i = MySpawnedBodyParts.Count - 1; i >= 0; i--)
     {
         if (MySpawnedBodyParts[i] != null)
         {
             if (MySpawnedBodyParts [i].GetComponent <BodyPart> ().TimeSpawned != 0)
             {
                 if (Time.time - MySpawnedBodyParts [i].GetComponent <BodyPart> ().TimeSpawned >= TimeFrozen)
                 {
                     if (MySpawnedBodyParts [i] != null)
                     {
                         if (MySpawnedBodyParts [i].GetComponent <Rigidbody> ())
                         {
                             MySpawnedBodyParts [i].GetComponent <Rigidbody> ().isKinematic = false;
                             if (IsForce)
                             {
                                 MySpawnedBodyParts [i].GetComponent <Rigidbody> ().velocity = ForceOnExplosion;                 // reset velocity
                                 ForceOnExplosion = new Vector3(Random.Range(-ForceStrength, ForceStrength),
                                                                Random.Range(-ForceStrength, ForceStrength),
                                                                Random.Range(-ForceStrength, ForceStrength));
                             }
                             if (CanTimeBeReversed)
                             {
                                 ReverseMovement MyReverseMovement = MySpawnedBodyParts [i].GetComponent <ReverseMovement> ();
                                 if (MyReverseMovement == null)
                                 {
                                     MyReverseMovement = MySpawnedBodyParts [i].AddComponent <ReverseMovement> ();
                                 }
                                 MyReverseMovement.ReverseTimeDilation = ReverseTimeDilation;
                             }
                         }
                     }
                     MySpawnedBodyParts [i].GetComponent <BodyPart> ().TimeSpawned = 0;
                 }
             }
         }
         else
         {
             MySpawnedBodyParts.RemoveAt(i);
         }
     }
 }
Esempio n. 3
0
        // need to check
        public void ReattachBodyPart(GameObject MyBodyPart)
        {
            BodyPart BodyPartComponent = MyBodyPart.GetComponent <BodyPart>();

            if (CanTimeBeReversed)
            {
                ReverseMovement MyReverseMovement = MyBodyPart.GetComponent <ReverseMovement> ();
                //Debug.LogError("Reattaching BodyParts v1 ");
                if (MyReverseMovement)
                {
                    MyReverseMovement.Reverse();
                    //Debug.LogError("Reattaching BodyParts");
                    MyReverseMovement.OnEndReverse.AddListener(                     // this ain't working atm! debug more!
                        delegate {
                        //Debug.LogError("Ending Reverse Movement: " + BodyPartComponent.name);
                        if (BodyPartComponent)
                        {
                            if (BodyPartComponent.OriginalBodyPart)
                            {
                                BodyPartComponent.OriginalBodyPart.SetActive(true);
                            }
                        }
                        //if (MyBodyPart.transform.childCount > 0)
                        //	Debug.LogError("Wut it contains child: " + MyBodyPart.transform.childCount);
                        RemoveBodyPart(MyBodyPart);
                        if (MySpawnedBodyParts.Count == 0)
                        {
                            OnRevive.Invoke();
                        }
                    });
                }
            }
            else                        // use general lerping to get bone back on

            {
            }
        }