Exemple #1
0
 public override bool CanBeExecuted(ZertzGame game)
 {
     ZertzBoard zb = game.Board;
     HexLocation zl = offset, dzl;
     ZertzPiece zp = zb[zl];
     if(!zp.IsAlive || !zp.ContainsBall) {
         this.locationCache = null;
         return false;
     }
     this.locationCache = new HexLocation[hops.Length+0x01];
     for(int i = 0x00; i < hops.Length; i++) {
         dzl = HexLocation.NeighbourDirections[(byte) hops[i]];
         zl += dzl;
         zp = zb[zl];
         this.locationCache[i] = zl;
         if(!zp.IsAlive || !zp.ContainsBall) {
             this.locationCache = null;
             return false;
         }
         zl += dzl;
         zp = zb[zl];
         if(!zp.IsAlive || zp.ContainsBall) {
             this.locationCache = null;
             return false;
         }
     }
     this.locationCache[hops.Length] = zl;
     return true;
 }
Exemple #2
0
        public override bool CanBeExecuted(ZertzGame game)
        {
            ZertzBoard  zb = game.Board;
            HexLocation zl = offset, dzl;
            ZertzPiece  zp = zb[zl];

            if (!zp.IsAlive || !zp.ContainsBall)
            {
                this.locationCache = null;
                return(false);
            }
            this.locationCache = new HexLocation[hops.Length + 0x01];
            for (int i = 0x00; i < hops.Length; i++)
            {
                dzl = HexLocation.NeighbourDirections[(byte)hops[i]];
                zl += dzl;
                zp  = zb[zl];
                this.locationCache[i] = zl;
                if (!zp.IsAlive || !zp.ContainsBall)
                {
                    this.locationCache = null;
                    return(false);
                }
                zl += dzl;
                zp  = zb[zl];
                if (!zp.IsAlive || zp.ContainsBall)
                {
                    this.locationCache = null;
                    return(false);
                }
            }
            this.locationCache[hops.Length] = zl;
            return(true);
        }
Exemple #3
0
 public ZertzGameScene()
 {
     this.zcr  = new ZertzCupRenderer(rc, 0x100);
     this.game = new ZertzGame(out hls);
     this.game.RegisterActionHandler(this);
     this.boardR = new ZertzBoardRenderer(this.game.Board.Width, this.game.Board.Height);
     si          = new StateIndicator(800, 200, 16.0f, this.game.Board.VisualRepresentation, this.game.Board.TextureBounds, this.game.Board.VisualFactor, new PointF[] { new PointF(1.0f / 12.0f, 0.5f), new PointF(2.0f / 12.0f, 0.33f), new PointF(2.0f / 12.0f, 0.67f), new PointF(3.0f / 12.0f, 0.33f), new PointF(3.0f / 12.0f, 0.67f), new PointF(4.0f / 12.0f, 0.5f), new PointF(5.0f / 12.0f, 0.5f) });
 }
Exemple #4
0
 public ZertzRingRenderer(ZertzGame game, HexLocation hexLocation, Vector3 tileVector, Vector3 tileEscape, float time)
 {
     register();
     this.tt            = new Vector3((float)UniversalRandom.NextDouble(), (float)UniversalRandom.NextDouble(), 0.0f);
     this.hexLocation   = hexLocation;
     this.boardLocation = Maths.HexVector(hexLocation, 2.0f * OUTER_RADIUS + SPACING, 0.5f * THICKNESS);
     this.tileVector    = tileVector;
     this.RenderMover   = RenderMoveManager.GenerateWaitMover(time, this.tileVector, RenderMoveManager.GenerateMoveMover(this.tileVector, tileEscape, 2.0f, RenderMoveManager.GenerateHopMover(tileEscape, this.boardLocation, 1.5f, null)));
     //this.RenderMover = RenderMoveManager.GenerateStaticMover(this.tileVector);
 }
Exemple #5
0
 public override void Execute(ZertzGame game)
 {
     if(this.locationCache == null && !this.CanBeExecuted(game)) {
         throw new InvalidZertzException("Can't execute invalid move.");
     }
     else {
         ZertzBoard zb = game.Board;
         zb[this.locationCache[this.hops.Length]].PutBall(zb[offset].DropBall());
         for(int i = 0x00; i < hops.Length; i++) {
             ZertzBallType zbt = game.Board[this.locationCache[i++]].DropBall();//TODO: collect
         }
     }
 }
Exemple #6
0
 public override void Execute(ZertzGame game)
 {
     if (this.locationCache == null && !this.CanBeExecuted(game))
     {
         throw new InvalidZertzException("Can't execute invalid move.");
     }
     else
     {
         ZertzBoard zb = game.Board;
         zb[this.locationCache[this.hops.Length]].PutBall(zb[offset].DropBall());
         for (int i = 0x00; i < hops.Length; i++)
         {
             ZertzBallType zbt = game.Board[this.locationCache[i++]].DropBall();                    //TODO: collect
         }
     }
 }
Exemple #7
0
 public override void Execute(ZertzGame game)
 {
     //TODO: implement
 }
Exemple #8
0
 public override bool CanBeExecuted(ZertzGame game)
 {
     return(false);           //TODO: implement
 }
Exemple #9
0
 public abstract void Execute(ZertzGame game);
Exemple #10
0
 public abstract bool CanBeExecuted(ZertzGame game);
 public override void Execute(ZertzGame game)
 {
     //TODO: implement
 }
 public override bool CanBeExecuted(ZertzGame game)
 {
     return false;//TODO: implement
 }
Exemple #13
0
        public static ZertzRingRenderer[] GenerateRings(RenderContainer rc, ZertzBoardRenderer board, ZertzGame game, ZertzCupRenderer cup, HexLocation[] hls, int offsetid)
        {
            int n  = hls.Length;
            int id = offsetid;
            ZertzRingRenderer zrr;

            ZertzRingRenderer[] list = new ZertzRingRenderer[n];
            ZertzTileRenderer   ztr;
            float time = n * TIME_FACTOR + TIME_OFFSET;

            for (int i = 0x00; i < n; i++)
            {
                ztr = cup.MinimalTile;
                zrr = new ZertzRingRenderer(game, hls[i], ztr.NextVector, ztr.TileEscapeLocation, time);
                board.PutRing(zrr, hls[i]);
                ztr.Add(zrr);
                list[i] = zrr;
                rc.Add(id++, zrr);
                time -= TIME_FACTOR;
            }
            cup.ClearTiles();
            return(list);
        }
Exemple #14
0
 public abstract bool CanBeExecuted(ZertzGame game);
Exemple #15
0
 public abstract void Execute(ZertzGame game);