コード例 #1
0
ファイル: BoingBones.cs プロジェクト: alex-carlson/GMTK2020
        public void AccumulateTarget(ref BoingEffector.Params effector)
        {
            for (int iChain = 0; iChain < BoneData.Length; ++iChain)
            {
                var chain = BoneChains[iChain];
                var aBone = BoneData[iChain];

                if (aBone == null)
                {
                    continue;
                }

                if (!chain.EffectorReaction)
                {
                    continue;
                }

                foreach (var bone in aBone)
                {
                    if (chain.ParamsOverride == null)
                    {
                        bone.Instance.AccumulateTarget(ref Params, ref effector);
                    }
                    else
                    {
                        Bits32 bits = chain.ParamsOverride.Params.Bits;
                        chain.ParamsOverride.Params.Bits = Params.Bits;
                        bone.Instance.AccumulateTarget(ref chain.ParamsOverride.Params, ref effector);
                        chain.ParamsOverride.Params.Bits = bits;
                    }
                }
            }
        }
コード例 #2
0
            public Params(BoingEffector effector)
            {
                Bits = new Bits32();
                Bits.SetBit(BoingWork.EffectorFlags.ContinuousMotion, effector.ContinuousMotion);

                float speedEffectRatio =
                    effector.MaxImpulseSpeed > MathUtil.Epsilon
          ? Mathf.Min(1.0f, effector.LinearSpeed / effector.MaxImpulseSpeed)
          : 1.0f;

                PrevPosition      = effector.m_prevPosition;
                CurrPosition      = effector.m_currPosition;
                LinearVelocityDir = VectorUtil.NormalizeSafe(effector.LinearVelocity, Vector3.zero);
                Radius            = effector.Radius;
                FullEffectRadius  = Radius * effector.FullEffectRadiusRatio;
                MoveDistance      = effector.MoveDistance;
                LinearImpulse     = speedEffectRatio * effector.LinearImpulse;
                RotateAngle       = effector.RotationAngle * MathUtil.Deg2Rad;
                AngularImpulse    = speedEffectRatio * effector.AngularImpulse * MathUtil.Deg2Rad;

                m_padding0 = 0.0f;
                m_padding1 = 0.0f;
                m_padding2 = 0.0f;
                m_padding3 = 0;
            }