상속: UnityEngine.MonoBehaviour
예제 #1
0
        /// <summary>
        /// Gets the InteractionTarget of the specified effector type and InteractionSystem tag.
        /// </summary>
        public InteractionTarget GetTarget(FullBodyBipedEffector effectorType, InteractionSystem interactionSystem)
        {
            if (interactionSystem.CompareTag(string.Empty) || interactionSystem.CompareTag(""))
            {
                foreach (InteractionTarget target in targets)
                {
                    if (target.effectorType == effectorType)
                    {
                        return(target);
                    }
                }

                return(null);
            }

            foreach (InteractionTarget target in targets)
            {
                if (target.effectorType == effectorType && target.CompareTag(interactionSystem.tag))
                {
                    return(target);
                }
            }

            return(null);
        }
예제 #2
0
        private float weight; // Current weight

        #endregion Fields

        #region Methods

        void Awake()
        {
            // Find the components
            interactionSystem = GetComponent<InteractionSystem>();
            lookAt = GetComponent<LookAtIK>();

            // Add to the interaction system delegates
            interactionSystem.OnInteractionStart += OnInteractionStart;
        }
예제 #3
0
        private float weight;         // Current weight

        void Awake()
        {
            // Find the components
            interactionSystem = GetComponent <InteractionSystem>();
            lookAt            = GetComponent <LookAtIK>();

            // Add to the interaction system delegates
            interactionSystem.OnInteractionStart += OnInteractionStart;
        }
예제 #4
0
 public void Initiate(InteractionSystem interactionSystem)
 {
     this.interactionSystem = interactionSystem;
     if (this.effector == null)
     {
         this.effector = interactionSystem.ik.solver.GetEffector(this.effectorType);
         this.poser    = this.effector.bone.GetComponent <Poser>();
     }
     this.StoreDefaults();
 }
예제 #5
0
        // Initiate this, get the default values
        public void Initiate(InteractionSystem interactionSystem)
        {
            this.interactionSystem = interactionSystem;

            // Find the effector if we haven't already
            effector = interactionSystem.ik.solver.GetEffector(effectorType);
            poser    = effector.bone.GetComponent <Poser>();

            StoreDefaults();
        }
		// Initiate this, get the default values
		public void Initiate(InteractionSystem interactionSystem) {
			this.interactionSystem = interactionSystem;

			// Find the effector if we haven't already
			if (effector == null) {
				effector = interactionSystem.ik.solver.GetEffector(effectorType);
				poser = effector.bone.GetComponent<Poser>();
			}

			StoreDefaults();
		}
예제 #7
0
			// Update this instance
			public void Update(InteractionSystem interactionSystem) {
				if (!initiated) return;

				// The default position
				Vector3 direction = spherecastFrom.TransformDirection(raycastDirectionLocal);
				hit.point = spherecastFrom.position + direction;

				// Spherecasting
				bool wallFound = FindWalls(direction);

				// Starting and ending the interactions
				if (!inTouch) {
					if (wallFound && Time.time > nextSwitchTime) {
						interactionObject.transform.parent = null;
						interactionSystem.StartInteraction(effectorType, interactionObject, true);
						nextSwitchTime = Time.time + minSwitchTime / interactionSystem.speed;

						targetPosition = hit.point;
						targetRotation = Quaternion.LookRotation(-hit.normal);

						interactionObject.transform.position = targetPosition;
						interactionObject.transform.rotation = targetRotation;
					}
				} else {
					if (!wallFound) {
						// Resume if no wall found
						StopTouch(interactionSystem);
					} else {
						if (!interactionSystem.IsPaused(effectorType) || sliding) {
							targetPosition = hit.point;
							targetRotation = Quaternion.LookRotation(-hit.normal);
						}
					}

					if (Vector3.Distance(interactionObject.transform.position, hit.point) > releaseDistance) {
						if (wallFound) {
							targetPosition = hit.point;
							targetRotation = Quaternion.LookRotation(-hit.normal);
						} else {
							StopTouch(interactionSystem);
						}
					}
				}

				float speedFTarget = !inTouch || (interactionSystem.IsPaused(effectorType) && interactionObject.transform.position == targetPosition)? 0f: 1f;
				speedF = Mathf.Lerp(speedF, speedFTarget, Time.deltaTime * 3f * interactionSystem.speed);

				// Interpolating the interaction object
				float s = Time.deltaTime * lerpSpeed * speedF * interactionSystem.speed;
				interactionObject.transform.position = Vector3.Lerp(interactionObject.transform.position, targetPosition, s);
				interactionObject.transform.rotation = Quaternion.Slerp(interactionObject.transform.rotation, targetRotation, s);
			}
 public void Initiate(InteractionSystem interactionSystem, IKSolverFullBodyBiped solver)
 {
     this.interactionSystem = interactionSystem;
     if (this.effector == null)
     {
         this.effector = solver.GetEffector(this.effectorType);
         this.poser    = this.effector.bone.GetComponent <Poser>();
     }
     this.defaultPull       = solver.GetChain(this.effectorType).pull;
     this.defaultReach      = solver.GetChain(this.effectorType).reach;
     this.defaultPush       = solver.GetChain(this.effectorType).push;
     this.defaultPushParent = solver.GetChain(this.effectorType).pushParent;
 }
예제 #9
0
		// Initiate this, get the default values
		public void Initiate(InteractionSystem interactionSystem, IKSolverFullBodyBiped solver) {
			this.interactionSystem = interactionSystem;

			// Find the effector if we haven't already
			if (effector == null) {
				effector = solver.GetEffector(effectorType);
				poser = effector.bone.GetComponent<Poser>();
			}

			defaultPull = solver.GetChain(effectorType).pull;
			defaultReach = solver.GetChain(effectorType).reach;
			defaultPush = solver.GetChain(effectorType).push;
			defaultPushParent = solver.GetChain(effectorType).pushParent;
		}
예제 #10
0
        // Initiate this, get the default values
        public void Initiate(InteractionSystem interactionSystem, IKSolverFullBodyBiped solver)
        {
            this.interactionSystem = interactionSystem;

            // Find the effector if we haven't already
            if (effector == null)
            {
                effector = solver.GetEffector(effectorType);
                poser    = effector.bone.GetComponent <Poser>();
            }

            defaultPull       = solver.GetChain(effectorType).pull;
            defaultReach      = solver.GetChain(effectorType).reach;
            defaultPush       = solver.GetChain(effectorType).push;
            defaultPushParent = solver.GetChain(effectorType).pushParent;
        }
예제 #11
0
			// Initiate this instance
			public void Initiate(InteractionSystem interactionSystem) {
				// Find the direction to the interaction objet relative to the sperecastFrom Transform
				raycastDirectionLocal = spherecastFrom.InverseTransformDirection(interactionObject.transform.position - spherecastFrom.position);

				// Find the max distance the sperecast
				raycastDistance = Vector3.Distance(spherecastFrom.position, interactionObject.transform.position);

				// Add to the interaction system delegates
				interactionSystem.OnInteractionStart += OnInteractionStart;
				interactionSystem.OnInteractionResume += OnInteractionResume;
				interactionSystem.OnInteractionStop += OnInteractionStop;

				hit.normal = Vector3.forward;
				targetPosition = interactionObject.transform.position;
				targetRotation = interactionObject.transform.rotation;

				initiated = true;
			}
예제 #12
0
 public InteractionTarget GetTarget(FullBodyBipedEffector effectorType, InteractionSystem interactionSystem)
 {
     if (interactionSystem.tag == string.Empty || interactionSystem.tag == "")
     {
         foreach (InteractionTarget interactionTarget in this.targets)
         {
             if (interactionTarget.effectorType == effectorType)
             {
                 return(interactionTarget);
             }
         }
         return(null);
     }
     foreach (InteractionTarget interactionTarget2 in this.targets)
     {
         if (interactionTarget2.effectorType == effectorType && interactionTarget2.tag == interactionSystem.tag)
         {
             return(interactionTarget2);
         }
     }
     return(null);
 }
예제 #13
0
 // Called when interaction is started with this InteractionObject
 public void OnStartInteraction(InteractionSystem interactionSystem)
 {
     this.lastUsedInteractionSystem = interactionSystem;
 }
예제 #14
0
 protected override void Action(InteractionSystem sys)
 {
     foreach (FullBodyBipedEffector effectorType in effectorTypes) {
         sys.ResumeInteraction(effectorType);
     }
 }
        }                                                                         // 0x00000001807DDBE0-0x00000001807DDC60

        // Methods
        public void Initiate(InteractionSystem interactionSystem)
        {
        }                                                                    // 0x00000001807DB920-0x00000001807DB9F0
예제 #16
0
        public InteractionObject handShake; // The HandShake InteractionObject

        #endregion Fields

        #region Methods

        void LateUpdate(InteractionSystem character1, InteractionSystem character2, InteractionObject handShake)
        {
            // Positioning the handshake to the middle of the hands
            Vector3 handsCenter = Vector3.Lerp(character1.ik.solver.rightHandEffector.bone.position, character2.ik.solver.rightHandEffector.bone.position, 0.5f);
            handShake.transform.position = handsCenter;
        }
예제 #17
0
			// Cleaning up the delegates
			public void Destroy(InteractionSystem interactionSystem) {
				if (!initiated) return;

				interactionSystem.OnInteractionStart -= OnInteractionStart;
				interactionSystem.OnInteractionResume -= OnInteractionResume;
				interactionSystem.OnInteractionStop -= OnInteractionStop;
			}
예제 #18
0
			// Stop touching the walls
			private void StopTouch(InteractionSystem interactionSystem) {
				interactionObject.transform.parent = interactionSystem.transform;
				nextSwitchTime = Time.time + minSwitchTime / interactionSystem.speed;

				if (interactionSystem.IsPaused(effectorType)) interactionSystem.ResumeInteraction(effectorType);
				else {
					speedF = 0f;
					targetPosition = hit.point;
					targetRotation = Quaternion.LookRotation(-hit.normal);
				}
			}
예제 #19
0
		void Awake() {
			interactionSystem = GetComponent<InteractionSystem>();
		}
예제 #20
0
		// Called when interaction is started with this InteractionObject
		public void OnStartInteraction(InteractionSystem interactionSystem) {
			this.lastUsedInteractionSystem = interactionSystem;
		}
        public Transform GetTarget(FullBodyBipedEffector effectorType, string tag) => default;                                  // 0x00000001807DF890-0x00000001807DFA50

        public void OnStartInteraction(InteractionSystem interactionSystem)
        {
        }                                                                              // 0x000000018027AC50-0x000000018027AC60
        }                                                                                                                       // 0x00000001807DFFD0-0x00000001807E02B0

        public InteractionTarget GetTarget(FullBodyBipedEffector effectorType, InteractionSystem interactionSystem) => default; // 0x00000001807DFA50-0x00000001807DFBD0