示例#1
0
		public CCGridActionState (CCGridAction action, CCNode target) : base (action, target)
		{
			GridSize = action.GridSize;
			CCGridBase targetGrid = Target.Grid;

			if (targetGrid != null && targetGrid.ReuseGrid > 0)
			{
				Grid = targetGrid;

				if (targetGrid.Active && targetGrid.GridSize.X == GridSize.X && targetGrid.GridSize.Y == GridSize.Y)
				{
					targetGrid.Reuse ();
				}
				else
				{
					Debug.Assert (false);
				}
			}
			else
			{
				if (targetGrid != null && targetGrid.Active)
				{
					targetGrid.Active = false;
				}

				CCGridBase newgrid = Grid;

				Target.Grid = newgrid;
				Target.Grid.Active = true;
			}
		}
示例#2
0
        public CCGridActionState(CCGridAction action, CCNode target) : base(action, target)
        {
            GridSize = action.GridSize;
            CCGridBase targetGrid = Target.Grid;

            if (targetGrid != null && targetGrid.ReuseGrid > 0)
            {
                Grid = targetGrid;

                if (targetGrid.Active && targetGrid.GridSize.X == GridSize.X && targetGrid.GridSize.Y == GridSize.Y)
                {
                    targetGrid.Reuse();
                }
                else
                {
                    Debug.Assert(false);
                }
            }
            else
            {
                if (targetGrid != null && targetGrid.Active)
                {
                    targetGrid.Active = false;
                }

                CCGridBase newgrid = Grid;

                Target.Grid        = newgrid;
                Target.Grid.Active = true;
            }
        }
示例#3
0
        public CCGridActionState(CCGridAction action, CCNode target) : base(action, target)
        {
            GridSize = action.GridSize;

            var gridNodeTarget = Target as CCNodeGrid;

            if (gridNodeTarget == null)
            {
                CCLog.Log("Obsolete -- Grid Actions should only target CCNodeGrids.");
            }

            CCGridBase targetGrid;

            if (gridNodeTarget != null)
            {
                targetGrid = gridNodeTarget.Grid;
            }
            else
            {
                targetGrid = Target.Grid;
            }

            if (targetGrid != null && targetGrid.ReuseGrid > 0)
            {
                Grid = targetGrid;

                if (targetGrid.Active && targetGrid.GridSize.X == GridSize.X && targetGrid.GridSize.Y == GridSize.Y)
                {
                    targetGrid.Reuse();
                }
                else
                {
                    Debug.Assert(false);
                }
            }
            else
            {
                if (targetGrid != null && targetGrid.Active)
                {
                    targetGrid.Active = false;
                }

                CCGridBase newgrid = Grid;
                if (gridNodeTarget != null)
                {
                    gridNodeTarget.Grid        = newgrid;
                    gridNodeTarget.Grid.Active = true;
                }
                else
                {
                    Target.Grid        = newgrid;
                    Target.Grid.Active = true;
                }
            }
        }
示例#4
0
		public CCGridActionState (CCGridAction action, CCNode target) : base (action, target)
		{
			GridSize = action.GridSize;

            var gridNodeTarget = Target as CCNodeGrid;
            if (gridNodeTarget == null)
                CCLog.Log("Obsolete -- Grid Actions should only target CCNodeGrids.");

            CCGridBase targetGrid;

            if (gridNodeTarget != null)
                targetGrid = gridNodeTarget.Grid;
            else
			    targetGrid = Target.Grid;

			if (targetGrid != null && targetGrid.ReuseGrid > 0)
			{
				Grid = targetGrid;

				if (targetGrid.Active && targetGrid.GridSize.X == GridSize.X && targetGrid.GridSize.Y == GridSize.Y)
				{
					targetGrid.Reuse ();
				}
				else
				{
					Debug.Assert (false);
				}
			}
			else
			{
				if (targetGrid != null && targetGrid.Active)
				{
					targetGrid.Active = false;
				}

				CCGridBase newgrid = Grid;
                if (gridNodeTarget != null)
                {
                    gridNodeTarget.Grid = newgrid;
                    gridNodeTarget.Grid.Active = true;
                }
                else
                {
                    Target.Grid = newgrid;
                    Target.Grid.Active = true;
                }
			}
		}
        public CCGridActionState(CCGridAction action, CCNodeGrid target) : base(action, target)
        {
            GridSize = action.GridSize;

            // If target is not a CCNodeGrid we will want to emmit a message and
            // return or there can be possible NRE's later on.
            var gridNodeTarget = Target as CCNodeGrid;

            if (gridNodeTarget == null)
            {
                Debug.Assert(false, "Grid Actions only target CCNodeGrids.");
                CCLog.Log("Grid Actions only target CCNodeGrids.");
                return;
            }

            CCGridBase targetGrid = target.Grid;

            if (targetGrid != null && targetGrid.ReuseGrid > 0)
            {
                Grid = targetGrid;

                if (targetGrid.Active && targetGrid.GridSize.X == GridSize.X && targetGrid.GridSize.Y == GridSize.Y)
                {
                    targetGrid.Reuse();
                }
                else
                {
                    Debug.Assert(false);
                }
            }
            else
            {
                if (targetGrid != null && targetGrid.Active)
                {
                    targetGrid.Active = false;
                }

                CCGridBase newgrid = Grid;
                if (target != null)
                {
                    target.Grid        = newgrid;
                    target.Grid.Active = true;
                }
            }
        }
示例#6
0
        public CCGridActionState (CCGridAction action, CCNodeGrid target) : base (action, target)
		{
			GridSize = action.GridSize;

            // If target is not a CCNodeGrid we will want to emmit a message and 
            // return or there can be possible NRE's later on.
            var gridNodeTarget = Target as CCNodeGrid;
            if (gridNodeTarget == null)
            {
                Debug.Assert(false, "Grid Actions only target CCNodeGrids.");
                CCLog.Log("Grid Actions only target CCNodeGrids.");
                return;
            }

            CCGridBase targetGrid = target.Grid;

			if (targetGrid != null && targetGrid.ReuseGrid > 0)
			{
				Grid = targetGrid;

				if (targetGrid.Active && targetGrid.GridSize.X == GridSize.X && targetGrid.GridSize.Y == GridSize.Y)
				{
					targetGrid.Reuse ();
				}
				else
				{
					Debug.Assert (false);
				}
			}
			else
			{
				if (targetGrid != null && targetGrid.Active)
				{
					targetGrid.Active = false;
				}

				CCGridBase newgrid = Grid;
                if (target != null)
                {
                    target.Grid = newgrid;
                    target.Grid.Active = true;
                }
			}
		}