Exemplo n.º 1
0
        // 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);
        }
Exemplo n.º 2
0
 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);
         }
     }
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        // 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);
                    }
                }
            }
        }
		// 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;
		}
		// 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);
				}
			}
		}