示例#1
0
        public bool Tick(LevelObjectInfo @object, SonicLevel level, Sonic.Sonic sonic)
        {
            if (@object.lastDrawTick != SonicManager.Instance.tickCount - 1)
                Init(@object, level, sonic);

            @object.lastDrawTick = SonicManager.Instance.tickCount;

            evalMe("tickScript").Me().apply(@object, new object[] {@object, level, sonic});

            if (@object.State.Truthy()) {
                @object.Xsp = @object.State.Xsp;
                @object.Ysp = @object.State.Ysp;
            }
            @object.X += @object.Xsp;
            @object.Y += @object.Ysp;
            return true;
        }
示例#2
0
        public bool Tick(LevelObjectInfo @object, SonicLevel level, Sonic.Sonic sonic)
        {
            if (Dead || ObjectData.Falsey()) return false;

            try {
                return ObjectData.Tick(@object, level, sonic);
            } catch (Exception EJ) {
                Log(EJ.Message, 0);

                return false;
            }
        }
 public void Draw(CanvasRenderingContext2D canvas, int x, int y, LevelObject framework, LevelObjectInfo instance, bool showHeightMap)
 {
     foreach (var j in instance.Pieces)
     {
         if (!j.Visible) continue;
         var piece = framework.Pieces[j.PieceIndex];
         var asset = framework.Assets[piece.AssetIndex];
         if (asset.Frames.Count > 0)
         {
             var frm = asset.Frames[j.FrameIndex];
             frm.DrawUI(canvas,
                        new Point((x /*+ j.X*/) - (frm.OffsetX), (y /*+ j.Y*/) - (frm.OffsetY)),
                 //                               new Point(frm.Width, frm.Height),
                        false,
                        showHeightMap,
                        showHeightMap,
                        false,
                        instance.Xflip ^ piece.Xflip,
                        instance.Yflip ^ piece.Yflip);
         }
     }
 }
示例#4
0
 public bool OnHurtSonic(LevelObjectInfo @object, SonicLevel level, Sonic.Sonic sonic, string sensor, dynamic piece)
 {
     return Script.Reinterpret<bool>(evalMe("hurtScript").Me().apply(@object, new object[] {@object, level, sonic, sensor, piece}));
 }
示例#5
0
 public void Init(LevelObjectInfo @object, SonicLevel level, Sonic.Sonic sonic)
 {
     @object.Reset();
     evalMe("initScript").Me().apply(@object, new object[] {@object, level, sonic});
 }