예제 #1
0
 public static Bone CopyOf(Bone bone)
 {
     return(new Bone
     {
         //OYM:这是什么骚操作
         Name = bone.Name,
         NameEn = bone.NameEn,
         Position = bone.Position,
         ParentIndex = bone.ParentIndex,
         TransformLevel = bone.TransformLevel,
         Rotatable = bone.Rotatable,
         Movable = bone.Movable,
         Visible = bone.Visible,
         Controllable = bone.Controllable,
         HasIk = bone.HasIk,
         AppendRotate = bone.AppendRotate,
         AppendTranslate = bone.AppendTranslate,
         RotAxisFixed = bone.RotAxisFixed,
         UseLocalAxis = bone.UseLocalAxis,
         PostPhysics = bone.PostPhysics,
         ReceiveTransform = bone.ReceiveTransform,
         ChildBoneVal = ChildBone.CopyOf(bone.ChildBoneVal),
         AppendBoneVal = AppendBone.CopyOf(bone.AppendBoneVal),
         RotAxis = bone.RotAxis,
         LocalAxisVal = LocalAxis.CopyOf(bone.LocalAxisVal),
         ExportKey = bone.ExportKey,
         IkInfoVal = IkInfo.CopyOf(bone.IkInfoVal),
     });
 }
예제 #2
0
        public IkModifier(ModifierInfo mi, Entity casterEntity, Entity targetEntity,
                          Environment environment,
                          CollectionOfInteractions modifierInteractionCollection) : base(mi, casterEntity, targetEntity, environment, modifierInteractionCollection)
        {
            this.environment = environment;
            this.info        = (IkInfo)mi;
            mapCollider      = environment.MapColliders();

            caster = casterEntity.GetComponent <SkillComponent>().Character;
            FrameAndSecondsConverter fasc = FrameAndSecondsConverter._30Fps;

            aimAt                    = 0;
            aimDuration              = fasc.FramesToSeconds(info.Config.aimDuration);
            aimLogicDuration         = fasc.FramesToSeconds(info.Config.aimLogicDuration);
            aimInterpolationDuration = fasc.FramesToSeconds(info.Config.aimInterpolationDuration);
            startupAt                = aimAt + aimDuration;
            startupDuration          = fasc.FramesToSeconds(info.Config.startupDuration);
            activeAt                 = startupAt + startupDuration;
            activeDuration           = fasc.FramesToSeconds(info.Config.activeDuration);
            recoveryAt               = activeAt + activeDuration;
            recoveryDuration         = fasc.FramesToSeconds(info.Config.recoveryDuration);
            totalDuration            = recoveryAt + recoveryDuration;
            target                   = environment.FindNearbyCharacters(
                caster, Vector3.zero, 999,
                new[] { FindingFilter.ExcludeMe, FindingFilter.ExcludeDead, FindingFilter.ExcludeAllies }
                )[0];
            fabrik = caster.GameObject().GetComponent <FABRIK>();
            IKSolverFABRIK solverFabrik = (IKSolverFABRIK)fabrik.GetIKSolver();

            ikJoint       = solverFabrik.bones[solverFabrik.bones.Length - 1].transform;
            ikJointParent = solverFabrik.bones[solverFabrik.bones.Length - 2].transform;
        }
예제 #3
0
        protected override List <Lifetime> CreateLifetimes(ModifierInfo modifierInfo)
        {
            IkInfo imi = (IkInfo)modifierInfo;

            return(new List <Lifetime>(new [] {
                new DurationBasedLifetime(imi.Config.ShowTotalDurationInSeconds()),
            }));
        }
예제 #4
0
            public static IkInfo CopyOf(IkInfo ikInfo) //OYM:返回blablabla,对了这里还有一个IKLink的数组
            {
                var ikLinksCopy = new IkLink[ikInfo.IkLinks.Length];

                ikInfo.IkLinks.CopyTo(ikLinksCopy, 0);
                return(new IkInfo
                {
                    IkTargetIndex = ikInfo.IkTargetIndex,
                    CcdIterateLimit = ikInfo.CcdIterateLimit,
                    CcdAngleLimit = ikInfo.CcdAngleLimit,
                    IkLinks = ikLinksCopy
                });
            }