コード例 #1
0
        void panelAppear(ref PanelInfo panel, ref Sprite2DRenderer sprite)
        {
            var dt = World.TinyEnvironment().frameDeltaTime;

            panel.Timer += dt;

//			var scl = scale.Value;
//			scl -= new float3( 0.9f * dt, 0.9f * dt, 0 );
//			scale.Value = scl;

            var col = sprite.color;

            col.a = panel.Timer * 2f;
            if (col.a > 1f)
            {
                col.a = 1f;
            }

            if (panel.Timer >= 0.5f)
            {
                panel.Status = PnlStNormal;
                panel.Timer  = 0;
                col.a        = 1f;
            }
            sprite.color = col;
        }
コード例 #2
0
        void panelMove(ref PanelInfo panel, ref Translation trans)
        {
            //Debug.LogFormatAlways( "nxt {0} {1}", panel.NextPos.x, panel.NextPos.y );
            var dt = World.TinyEnvironment().frameDeltaTime;

            float t   = 0.1f;                   // 移動時間.
            float spd = 1f / t;                 // 移動速度.

            float vx = (panel.NextPos.x - panel.CellPos.x) * 128f * spd * dt;
            float vy = -(panel.NextPos.y - panel.CellPos.y) * 128f * spd * dt;


            var pos = trans.Value;

            pos.x      += vx;
            pos.y      += vy;
            trans.Value = pos;

            panel.Timer += dt;
            if (panel.Timer >= t)
            {
                panel.CellPos = panel.NextPos;

                float3 orgPos = new float3(InitPanelSystem.OrgX, InitPanelSystem.OrgY, 0);
                //orgPos.x = -128f * 2f + 64f;
                //orgPos.y = 128f * 2f - 64f;

                float3 newpos = new float3(panel.NextPos.x * 128f, -panel.NextPos.y * 128f, 0);
                newpos     += orgPos;
                trans.Value = newpos;

                panel.Timer  = 0;
                panel.Status = PnlStNormal;

                //if( panel.Type == 1 && panel.NextPos.x == 3 && panel.NextPos.y == 3 ) {
                //	Debug.LogAlways("GOAL");
                //}
            }
        }
コード例 #3
0
 void panelNormNew(ref PanelInfo panel, ref NativeArray <int> infoAry, ref int2 hitCell, ref int2 blankCell, int dir)
 {
     if (dir == 0)                // 上.
     {
         if (panel.CellPos.x == hitCell.x && (panel.CellPos.y > blankCell.y && panel.CellPos.y <= hitCell.y))
         {
             panel.Status  = PnlStMove;
             panel.NextPos = panel.CellPos;
             panel.NextPos.y--;
         }
     }
     else if (dir == 1)
     {
         if (panel.CellPos.x == hitCell.x && (panel.CellPos.y < blankCell.y && panel.CellPos.y >= hitCell.y))
         {
             panel.Status  = PnlStMove;
             panel.NextPos = panel.CellPos;
             panel.NextPos.y++;
         }
     }
     else if (dir == 2)
     {
         if (panel.CellPos.y == hitCell.y && (panel.CellPos.x > blankCell.x && panel.CellPos.x <= hitCell.x))
         {
             panel.Status  = PnlStMove;
             panel.NextPos = panel.CellPos;
             panel.NextPos.x--;
         }
     }
     else if (dir == 3)
     {
         if (panel.CellPos.y == hitCell.y && (panel.CellPos.x < blankCell.x && panel.CellPos.x >= hitCell.x))
         {
             panel.Status  = PnlStMove;
             panel.NextPos = panel.CellPos;
             panel.NextPos.x++;
         }
     }
 }
コード例 #4
0
        bool panelDisapper(ref PanelInfo panel, ref NonUniformScale scale, ref Sprite2DRenderer sprite)
        {
            //Debug.LogAlways("disapp");
            var dt = World.TinyEnvironment().frameDeltaTime;

            panel.Timer += dt;

            var scl = scale.Value;

            scl        -= new float3(1.9f * dt, 1.9f * dt, 0);
            scale.Value = scl;

            var col = sprite.color;

            col.a       -= 1.9f * dt;
            sprite.color = col;


            if (panel.Timer >= 0.5f)
            {
                return(true);
            }
            return(false);
        }
コード例 #5
0
        void panelNorm(ref PanelInfo panel, ref Translation trans, ref NativeArray <int> infoAry)
        {
            float2 size = new float2();

            size.x = size.y = 128f;

            float3 mypos       = trans.Value;
            var    inputSystem = World.GetExistingSystem <InputSystem>();
            float3 mousePos    = inputSystem.GetWorldInputPosition();
            //Debug.LogFormatAlways( "x {0} y {1} z {2}", mousePos.x, mousePos.y, mousePos.z );

            // マウスとのあたり.
            // todo 複数パネル移動対応.
            bool res = OverlapsObjectCollider(mypos, mousePos, size);

            if (res)
            {
                //Debug.LogFormatAlways( "hit {0}, {1}", panel.CellPos.x, panel.CellPos.y );

                // 動けるかチェック.
                // up
                if (panel.CellPos.y > 0)
                {
                    int idx = panel.CellPos.x + (panel.CellPos.y - 1) * 4;
                    if (infoAry[idx] == 0)
                    {
                        panel.NextPos = panel.CellPos;
                        panel.NextPos.y--;
                        panel.Status = PnlStMove;
                        return;
                    }
                }
                // down
                if (panel.CellPos.y < 3)
                {
                    int idx = panel.CellPos.x + (panel.CellPos.y + 1) * 4;
                    if (infoAry[idx] == 0)
                    {
                        panel.NextPos = panel.CellPos;
                        panel.NextPos.y++;
                        panel.Status = PnlStMove;
                        return;
                    }
                }
                // left
                if (panel.CellPos.x > 0)
                {
                    int idx = panel.CellPos.x - 1 + panel.CellPos.y * 4;
                    if (infoAry[idx] == 0)
                    {
                        panel.NextPos = panel.CellPos;
                        panel.NextPos.x--;
                        panel.Status = PnlStMove;
                        return;
                    }
                }
                // right
                if (panel.CellPos.x < 3)
                {
                    int idx = panel.CellPos.x + 1 + panel.CellPos.y * 4;
                    if (infoAry[idx] == 0)
                    {
                        panel.NextPos = panel.CellPos;
                        panel.NextPos.x++;
                        panel.Status = PnlStMove;
                        return;
                    }
                }
            }
        }