public bool Start(InteractionObject interactionObject, string tag, float fadeInTime, bool interrupt) { if (!this.inInteraction) { this.effector.position = this.effector.bone.position; this.effector.rotation = this.effector.bone.rotation; } else if (!interrupt) { return(false); } this.target = interactionObject.GetTarget(this.effectorType, tag); if (this.target == null) { return(false); } this.interactionTarget = this.target.GetComponent <InteractionTarget>(); this.interactionObject = interactionObject; if (this.interactionSystem.OnInteractionStart != null) { this.interactionSystem.OnInteractionStart(this.effectorType, interactionObject); } interactionObject.OnStartInteraction(this.interactionSystem); this.triggered.Clear(); for (int i = 0; i < interactionObject.events.Length; i++) { this.triggered.Add(false); } if (this.poser != null) { if (this.poser.poseRoot == null) { this.poser.weight = 0f; } if (this.interactionTarget != null) { this.poser.poseRoot = this.target.transform; } else { this.poser.poseRoot = null; } this.poser.AutoMapping(); } this.timer = 0f; this.weight = 0f; this.fadeInSpeed = ((fadeInTime <= 0f) ? 1000f : (1f / fadeInTime)); this.length = interactionObject.length; this.isPaused = false; this.pickedUp = false; this.pickUpPosition = Vector3.zero; this.pickUpRotation = Quaternion.identity; if (this.interactionTarget != null) { this.interactionTarget.RotateTo(this.effector.bone.position); } return(true); }
// Start interaction public bool Start(InteractionObject interactionObject, string tag, float fadeInTime, bool interrupt) { // Get the InteractionTarget target = interactionObject.GetTarget(effectorType, tag); if (target == null) { return(false); } interactionTarget = target.GetComponent <InteractionTarget>(); return(Start(interactionObject, interactionTarget, fadeInTime, interrupt)); }
public float GetValue(InteractionObject.WeightCurve.Type weightCurveType, InteractionTarget target, float timer) { int weightCurveIndex = this.GetWeightCurveIndex(weightCurveType); if (weightCurveIndex != -1) { float num = (!(target == null)) ? target.GetValue(weightCurveType) : 1f; return(this.weightCurves[weightCurveIndex].GetValue(timer) * num); } for (int i = 0; i < this.multipliers.Length; i++) { if (this.multipliers[i].result == weightCurveType) { int weightCurveIndex2 = this.GetWeightCurveIndex(this.multipliers[i].curve); if (weightCurveIndex2 != -1) { float num2 = (!(target == null)) ? target.GetValue(this.multipliers[i].result) : 1f; return(this.multipliers[i].GetValue(this.weightCurves[weightCurveIndex2], timer) * num2); } } } return(0f); }
/// <summary> /// Triggers all interactions of an InteractionTrigger. Returns false if unsuccessful (maybe out of range). /// </summary> public bool TriggerInteraction(int index, bool interrupt, out InteractionTarget interactionTarget) { interactionTarget = null; if (!IsValid(true)) { return(false); } if (!TriggerIndexIsValid(index)) { return(false); } bool all = true; var range = triggersInRange[index].ranges[bestRangeIndexes[index]]; for (int i = 0; i < range.interactions.Length; i++) { for (int e = 0; e < range.interactions[i].effectors.Length; e++) { var interactionObject = range.interactions[i].interactionObject; var t = interactionObject.GetTarget(range.interactions[i].effectors[e], tag); if (t != null) { interactionTarget = t.GetComponent <InteractionTarget>(); } bool s = StartInteraction(range.interactions[i].effectors[e], interactionObject, interrupt); if (!s) { all = false; } } } return(all); }
// Applies the weight curves and multipliers to the FBBIK solver public void Apply(IKSolverFullBodyBiped solver, FullBodyBipedEffector effector, InteractionTarget target, float timer, float weight) { for (int i = 0; i < weightCurves.Length; i++) { float mlp = target == null? 1f: target.GetValue(weightCurves[i].type); Apply(solver, effector, weightCurves[i].type, weightCurves[i].GetValue(timer), weight * mlp); } for (int i = 0; i < multipliers.Length; i++) { if (multipliers[i].curve == multipliers[i].result) { if (!Warning.logged) Warning.Log("InteractionObject Multiplier 'Curve' " + multipliers[i].curve.ToString() + "and 'Result' are the same.", transform); } int curveIndex = GetWeightCurveIndex(multipliers[i].curve); if (curveIndex != -1) { float mlp = target == null? 1f: target.GetValue(multipliers[i].result); Apply(solver, effector, multipliers[i].result, multipliers[i].GetValue(weightCurves[curveIndex], timer), weight * mlp); } else { if (!Warning.logged) Warning.Log("InteractionObject Multiplier curve " + multipliers[i].curve.ToString() + "does not exist.", transform); } } }
// Applies the weight curves and multipliers to the FBBIK solver public void Apply(IKSolverFullBodyBiped solver, FullBodyBipedEffector effector, InteractionTarget target, float timer, float weight) { for (int i = 0; i < weightCurves.Length; i++) { float mlp = target == null? 1f: target.GetValue(weightCurves[i].type); Apply(solver, effector, weightCurves[i].type, weightCurves[i].GetValue(timer), weight * mlp); } for (int i = 0; i < multipliers.Length; i++) { if (multipliers[i].curve == multipliers[i].result) { if (!Warning.logged) { Warning.Log("InteractionObject Multiplier 'Curve' " + multipliers[i].curve.ToString() + "and 'Result' are the same.", transform); } } int curveIndex = GetWeightCurveIndex(multipliers[i].curve); if (curveIndex != -1) { float mlp = target == null? 1f: target.GetValue(multipliers[i].result); Apply(solver, effector, multipliers[i].result, multipliers[i].GetValue(weightCurves[curveIndex], timer), weight * mlp); } else { if (!Warning.logged) { Warning.Log("InteractionObject Multiplier curve " + multipliers[i].curve.ToString() + "does not exist.", transform); } } } }
// Start interaction public bool Start(InteractionObject interactionObject, string tag, float fadeInTime, bool interrupt) { // If not in interaction, set effector positions to their bones if (!inInteraction) { effector.position = effector.bone.position;; effector.rotation = effector.bone.rotation;; } else { if (!interrupt) { return(false); } } // Get the InteractionTarget target = interactionObject.GetTarget(effectorType, tag); if (target == null) { return(false); } interactionTarget = target.GetComponent <InteractionTarget>(); // Start the interaction this.interactionObject = interactionObject; if (interactionSystem.OnInteractionStart != null) { interactionSystem.OnInteractionStart(effectorType, interactionObject); } interactionObject.OnStartInteraction(interactionSystem); // Cleared triggered events triggered.Clear(); for (int i = 0; i < interactionObject.events.Length; i++) { triggered.Add(false); } // Posing the hand/foot if (poser != null) { if (poser.poseRoot == null) { poser.weight = 0f; } if (interactionTarget != null) { poser.poseRoot = target.transform; } else { poser.poseRoot = null; } poser.AutoMapping(); } // See which InteractionObject.WeightCurve.Types are used //private bool positionWeightUsed, rotationWeightUsed, pullUsed, reachUsed, pushUsed, pushParentUsed, poserUsed; positionWeightUsed = interactionObject.CurveUsed(InteractionObject.WeightCurve.Type.PositionWeight); rotationWeightUsed = interactionObject.CurveUsed(InteractionObject.WeightCurve.Type.RotationWeight); pullUsed = interactionObject.CurveUsed(InteractionObject.WeightCurve.Type.Pull); reachUsed = interactionObject.CurveUsed(InteractionObject.WeightCurve.Type.Reach); pushUsed = interactionObject.CurveUsed(InteractionObject.WeightCurve.Type.Push); pushParentUsed = interactionObject.CurveUsed(InteractionObject.WeightCurve.Type.PushParent); //poserUsed = interactionObject.CurveUsed(InteractionObject.WeightCurve.Type.PoserWeight); StoreDefaults(); // Reset internal values timer = 0f; weight = 0f; fadeInSpeed = fadeInTime > 0f? 1f / fadeInTime: 1000f; length = interactionObject.length; isPaused = false; pickedUp = false; pickUpPosition = Vector3.zero; pickUpRotation = Quaternion.identity; if (interactionTarget != null) { interactionTarget.RotateTo(effector.bone.position); } started = true; return(true); }
public void Apply(IKSolverFullBodyBiped solver, FullBodyBipedEffector effector, InteractionTarget target, float timer, float weight) { for (int i = 0; i < this.weightCurves.Length; i++) { float num = (!(target == null)) ? target.GetValue(this.weightCurves[i].type) : 1f; this.Apply(solver, effector, this.weightCurves[i].type, this.weightCurves[i].GetValue(timer), weight * num); } for (int j = 0; j < this.multipliers.Length; j++) { if (this.multipliers[j].curve == this.multipliers[j].result && !Warning.logged) { Warning.Log("InteractionObject Multiplier 'Curve' " + this.multipliers[j].curve.ToString() + "and 'Result' are the same.", base.transform, false); } int weightCurveIndex = this.GetWeightCurveIndex(this.multipliers[j].curve); if (weightCurveIndex != -1) { float num2 = (!(target == null)) ? target.GetValue(this.multipliers[j].result) : 1f; this.Apply(solver, effector, this.multipliers[j].result, this.multipliers[j].GetValue(this.weightCurves[weightCurveIndex], timer), weight * num2); } else if (!Warning.logged) { Warning.Log("InteractionObject Multiplier curve " + this.multipliers[j].curve.ToString() + "does not exist.", base.transform, false); } } }
// Start interaction public void Start(InteractionObject interactionObject, string tag, float fadeInTime, bool interrupt) { // If not in interaction, set effector positions to their bones if (!inInteraction) { effector.position = effector.bone.position; effector.rotation = effector.bone.rotation; } else if (!interrupt) { return; } // Get the InteractionTarget target = interactionObject.GetTarget(effectorType, tag); if (target == null) { return; } interactionTarget = target.GetComponent <InteractionTarget>(); // Start the interaction this.interactionObject = interactionObject; if (OnStart != null) { OnStart(effectorType, interactionObject); } // Posing the hand/foot if (poser != null) { if (poser.poseRoot == null) { poser.weight = 0f; } if (interactionTarget != null) { poser.poseRoot = target.transform; } else { poser.poseRoot = null; } poser.AutoMapping(); } // Reset internal values timer = 0f; weight = 0f; fadeInSpeed = fadeInTime > 0f? 1f / fadeInTime: 1000f; length = interactionObject.length; triggered = false; released = false; isPaused = false; pickedUp = false; pickUpPosition = Vector3.zero; pickUpRotation = Quaternion.identity; // Call StartInteraction on the InteractionObject interactionObject.StartInteraction(effector.bone); if (interactionTarget != null) { interactionTarget.RotateTo(effector.bone.position); } }
// Gets the value of a weight curve/multiplier public float GetValue(WeightCurve.Type weightCurveType, InteractionTarget target, float timer) { int index = GetWeightCurveIndex(weightCurveType); if (index != -1) { float mlp = target == null? 1f: target.GetValue(weightCurveType); return weightCurves[index].GetValue(timer) * mlp; } for (int i = 0; i < multipliers.Length; i++) { if (multipliers[i].result == weightCurveType) { int wIndex = GetWeightCurveIndex(multipliers[i].curve); if (wIndex != -1) { float mlp = target == null? 1f: target.GetValue(multipliers[i].result); return multipliers[i].GetValue(weightCurves[wIndex], timer) * mlp; } } } return 0f; }
/// <summary> /// Starts the interaction between an effector and a specific interaction target. /// </summary> public bool StartInteraction(FullBodyBipedEffector effectorType, InteractionObject interactionObject, InteractionTarget target, bool interrupt) { if (!IsValid(true)) { return(false); } if (interactionObject == null) { return(false); } for (int i = 0; i < interactionEffectors.Length; i++) { if (interactionEffectors[i].effectorType == effectorType) { return(interactionEffectors[i].Start(interactionObject, target, fadeInTime, interrupt)); } } return(false); }
// Start interaction public bool Start(InteractionObject interactionObject, string tag, float fadeInTime, bool interrupt) { // If not in interaction, set effector positions to their bones if (!inInteraction) { effector.position = effector.bone.position;; effector.rotation = effector.bone.rotation;; } else { if (!interrupt) return false; } // Get the InteractionTarget target = interactionObject.GetTarget(effectorType, tag); if (target == null) return false; interactionTarget = target.GetComponent<InteractionTarget>(); // Start the interaction this.interactionObject = interactionObject; if (interactionSystem.OnInteractionStart != null) interactionSystem.OnInteractionStart(effectorType, interactionObject); interactionObject.OnStartInteraction(interactionSystem); // Cleared triggered events triggered.Clear(); for (int i = 0; i < interactionObject.events.Length; i++) { triggered.Add(false); } // Posing the hand/foot if (poser != null) { if (poser.poseRoot == null) poser.weight = 0f; if (interactionTarget != null) poser.poseRoot = target.transform; else poser.poseRoot = null; poser.AutoMapping(); } // Reset internal values timer = 0f; weight = 0f; fadeInSpeed = fadeInTime > 0f? 1f / fadeInTime: 1000f; length = interactionObject.length; isPaused = false; pickedUp = false; pickUpPosition = Vector3.zero; pickUpRotation = Quaternion.identity; if (interactionTarget != null) interactionTarget.RotateTo(effector.bone.position); started = true; return true; }
} // 0x00000001807DF1C0-0x00000001807DF750 public float GetValue(WeightCurve.Type weightCurveType, InteractionTarget target, float timer) => default; // 0x00000001807DFC60-0x00000001807DFF60
} // 0x000000018027AC50-0x000000018027AC60 public void Apply(IKSolverFullBodyBiped solver, FullBodyBipedEffector effector, InteractionTarget target, float timer, float weight) { } // 0x00000001807DF1C0-0x00000001807DF750
// Start interaction public bool Start(InteractionObject interactionObject, string tag, float fadeInTime, bool interrupt) { // If not in interaction, set effector positions to their bones if (!inInteraction) { effector.position = effector.bone.position;; effector.rotation = effector.bone.rotation;; } else { if (!interrupt) { return(false); } } // Get the InteractionTarget target = interactionObject.GetTarget(effectorType, tag); if (target == null) { return(false); } interactionTarget = target.GetComponent <InteractionTarget>(); // Start the interaction this.interactionObject = interactionObject; if (interactionSystem.OnInteractionStart != null) { interactionSystem.OnInteractionStart(effectorType, interactionObject); } // Cleared triggered events triggered.Clear(); for (int i = 0; i < interactionObject.events.Length; i++) { triggered.Add(false); } // Posing the hand/foot if (poser != null) { if (poser.poseRoot == null) { poser.weight = 0f; } if (interactionTarget != null) { poser.poseRoot = target.transform; } else { poser.poseRoot = null; } poser.AutoMapping(); } // Reset internal values timer = 0f; weight = 0f; fadeInSpeed = fadeInTime > 0f? 1f / fadeInTime: 1000f; length = interactionObject.length; isPaused = false; pickedUp = false; pickUpPosition = Vector3.zero; pickUpRotation = Quaternion.identity; if (interactionTarget != null) { interactionTarget.RotateTo(effector.bone.position); } return(true); }
// Start interaction public void Start(InteractionObject interactionObject, string tag, float fadeInTime, bool interrupt) { // If not in interaction, set effector positions to their bones if (!inInteraction) { effector.position = effector.bone.position; effector.rotation = effector.bone.rotation; } else if (!interrupt) return; // Get the InteractionTarget target = interactionObject.GetTarget(effectorType, tag); if (target == null) return; interactionTarget = target.GetComponent<InteractionTarget>(); // Start the interaction this.interactionObject = interactionObject; if (OnStart != null) OnStart(effectorType, interactionObject); // Posing the hand/foot if (poser != null) { if (poser.poseRoot == null) poser.weight = 0f; if (interactionTarget != null) poser.poseRoot = target.transform; else poser.poseRoot = null; poser.AutoMapping(); } // Reset internal values timer = 0f; weight = 0f; fadeInSpeed = fadeInTime > 0f? 1f / fadeInTime: 1000f; length = interactionObject.length; triggered = false; released = false; isPaused = false; pickedUp = false; pickUpPosition = Vector3.zero; pickUpRotation = Quaternion.identity; // Call StartInteraction on the InteractionObject interactionObject.StartInteraction(effector.bone); if (interactionTarget != null) interactionTarget.RotateTo(effector.bone.position); }