示例#1
0
        public CharacterEntity(ThrongGameScreen gameScreen, Clip clip,
            Vector2 position, Vector2 scale, float rotation, Vector2 physicsOffset, float physicsRadius)
        {
            ClipInstance = new ClipInstance(clip);
            GameScreen = gameScreen;
            Position = position; Scale = scale; Rotation = rotation;
            _physicsRadius = physicsRadius;
            _physicsOffset = physicsOffset;
            IsValid = true;

            SetupDynamics();
        }
示例#2
0
        public override void Initialize(GameScreen parentScreen)
        {
            base.Initialize(parentScreen);

            // Load the clip. Note that this instance is shared with all
            // entities that want this clip file.
            Clip clip = parentScreen.Content.Load<Clip>(Settings.ClipFile);
            clip.Init(parentScreen.Content);

            // Create the ClipInstance. This allows different entities to
            // share the same clip and play their own animations on it
            ClipInstance = new ClipInstance(clip);

            // Set the initial position of the clip instance
            ClipInstance.Position = Settings.Position;
            ClipInstance.Origin = Settings.Origin;
            ClipInstance.Rotation = MathHelper.ToRadians(Settings.Rotation);
            ClipInstance.Scale = Settings.Scale;
            FlipX = Settings.FlipX;
            FlipY = Settings.FlipY;

            if (string.IsNullOrEmpty(Settings.DefaultAnimName))
            {
                ClipInstance.Play(clip.AnimSet.Anims[0], Settings.DefaultAnimLooping);
            }
            else
            {
                ClipInstance.Play(Settings.DefaultAnimName, Settings.DefaultAnimLooping);
            }
            ClipInstance.Update(Settings.DefaultAnimOffset);
        }
示例#3
0
 public ClipAnimInstance(ClipInstance clipInstance)
 {
     parentClipInstance = clipInstance;
     // There are potentially 3 types of animation per joint
     JointAnimStates = new JointAnimState <JointAnim> [parentClipInstance.Clip.Joints.Length * 3];
 }
示例#4
0
 public void LinkToParentClipInstance(ClipInstance parentClipInstance, int parentJointId)
 {
     linkToParentClipInstance = parentClipInstance;
     linkToParetJointId       = parentJointId;
 }
示例#5
0
 public ClipAnimInstance(ClipInstance clipInstance)
 {
     parentClipInstance = clipInstance;
     // There are potentially 3 types of animation per joint
     JointAnimStates = new JointAnimState<JointAnim>[parentClipInstance.Clip.Joints.Length * 3];
 }
示例#6
0
 public void LinkToParentClipInstance(ClipInstance parentClipInstance, int parentJointId)
 {
     linkToParentClipInstance = parentClipInstance;
     linkToParetJointId = parentJointId;
 }