Esempio n. 1
0
        protected virtual void InitVarDefs(SpriterAnimation animation)
        {
            if (animation.Meta != null && animation.Meta.Varlines != null && animation.Meta.Varlines.Length > 0)
            {
                foreach (SpriterVarline varline in animation.Meta.Varlines)
                {
                    SpriterVarDef varDefs = animation.Entity.Variables[varline.Def];
                    Init(varDefs, varline);
                }
            }

            foreach (SpriterTimeline timeline in animation.Timelines)
            {
                if (timeline.Meta == null || timeline.Meta.Varlines == null || timeline.Meta.Varlines.Length == 0)
                {
                    continue;
                }
                SpriterObjectInfo objInfo = animation.Entity.ObjectInfos.First(o => o.Name == timeline.Name);
                foreach (SpriterVarline varline in timeline.Meta.Varlines)
                {
                    SpriterVarDef varDef = objInfo.Variables[varline.Def];
                    Init(varDef, varline);
                }
            }
        }
Esempio n. 2
0
        protected override void ApplyBoxTransform(SpriterObjectInfo objInfo, SpriterObject info)
        {
            GameObject child          = childData.Boxes[boxIndex];
            GameObject pivot          = childData.BoxPivots[boxIndex];
            Transform  childTransform = childData.BoxTransforms[boxIndex];
            Transform  pivotTransform = childData.BoxPivotTransforms[boxIndex];

            child.SetActive(true);
            pivot.SetActive(true);

            float w = objInfo.Width / ppu;
            float h = objInfo.Height / ppu;

            BoxCollider2D collider = child.GetComponent <BoxCollider2D>();

            collider.size = new Vector2(w, h);

            child.name = objInfo.Name;

            float deltaX = (DefaultPivot - info.PivotX) * w * info.ScaleX;
            float deltaY = (DefaultPivot - info.PivotY) * h * info.ScaleY;

            pivotTransform.localEulerAngles = new Vector3(0, 0, info.Angle);
            pivotTransform.localPosition    = new Vector3(info.X / ppu, info.Y / ppu, 0);
            childTransform.localPosition    = new Vector3(deltaX, deltaY, childTransform.localPosition.z);
            childTransform.localScale       = new Vector3(info.ScaleX, info.ScaleY, 1);
            ++boxIndex;
        }
 protected override void ApplyBoxTransform(SpriterObjectInfo objInfo, SpriterObject info)
 {
     if (DrawBoxOutlines)
     {
         Box bounds = GetBoundingBox(info, objInfo.Width, objInfo.Height);
         AddForDrawing(bounds);
     }
 }
Esempio n. 4
0
        protected override void ApplyBoxTransform(SpriterObjectInfo objInfo, SpriterObject info)
        {
            if (!GameConfig.DebugPhysics)
            {
                return;
            }

            ApplySpriteTransform(_boxTextures[objInfo.Name], info);
        }
 protected override void ApplyBoxTransform(SpriterObjectInfo objInfo, SpriterObject info)
 {
     ApplySpriteTransform(boxTextures[objInfo.Name], info);
 }