Inheritance: 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
ファイル: InteractionLookAt.cs プロジェクト: mradfo21/Rainbow
        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();
        }
コード例 #6
0
		// 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);
			}
コード例 #8
0
 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
ファイル: InteractionEffector.cs プロジェクト: zwong91/Titan
        // 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);
     }
 }
コード例 #15
0
        }                                                                         // 0x00000001807DDBE0-0x00000001807DDC60

        // Methods
        public void Initiate(InteractionSystem interactionSystem)
        {
        }                                                                    // 0x00000001807DB920-0x00000001807DB9F0
コード例 #16
0
ファイル: Handshake.cs プロジェクト: shilon/UnityProjects
        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;
		}
コード例 #21
0
        public Transform GetTarget(FullBodyBipedEffector effectorType, string tag) => default;                                  // 0x00000001807DF890-0x00000001807DFA50

        public void OnStartInteraction(InteractionSystem interactionSystem)
        {
        }                                                                              // 0x000000018027AC50-0x000000018027AC60
コード例 #22
0
        }                                                                                                                       // 0x00000001807DFFD0-0x00000001807E02B0

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