Пример #1
0
 //产生方块;
 public void SpawnBlock()
 {
     currentBlock = Instantiate(shaps[Random.Range(0, blocksNum)]);
     currentBlock.SetColor(colors[Random.Range(0, colorNum)]);
     currentBlock.transform.SetParent(blockHolder);
     Debug.Log("进入");
 }
Пример #2
0
 public Unit(int cid, bool isControl, Shap shap, Vector3 bronPoint)
 {
     this.cid       = cid;
     this.isControl = isControl;
     this.shap      = shap;
     this.bronPoint = bronPoint;
     actions        = new LinkedBlockingQueue <IAction>();
     effects        = new Queue <IEffect>();
     states         = new Dictionary <int, IState>();
 }
Пример #3
0
 //物体落下后的处理
 public void FallDownHandle()
 {
     currentBlock = null;
     if (IsGameOver())
     {
         fsm.PerformTransition(Transition.GameOver);
         PlayerPrefs.SetInt("highScore", facade.Model.HighScore);
         isPause = true;
     }
 }
Пример #4
0
        //private Dictionary<int, MobileEntity> hashMat = new Dictionary<int, MobileEntity>();
        /// <summary>
        /// 判断元胞是否被占用了
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        internal bool IsOccupied(OxyzPointF opP)
        {
//			var mobileNode = base.First;
//			//update mobile on a lane one by one
//			while(mobileNode!=null) {
//				var mobile = mobileNode.Value;
//				//mobile is possibaly be deleted
//
//				if (mobile.IsMoved==true) {
//					//switch off
//					mobile.IsMoved = false;
//
//					foreach (var prevShap in mobile.PrevShape) {
//						int iKey = prevShap.GetHashCode();
//						if (this.hashMat.ContainsKey(iKey)==true) {
//							this.hashMat.Remove(iKey);
//						}
//
//					}
//
//					foreach (var Shap in mobile.Shape) {
//						int iKey = Shap.GetHashCode();
//						if (this.hashMat.ContainsKey(iKey)==false) {
//							this.hashMat.Add(iKey,mobile);
//						}
//					}
//
//				}
//				mobileNode = mobileNode.Next;
//			}
//
//			return this.hashMat.ContainsKey(opP.GetHashCode());

            //-----------------------------------------------------------
            var mobileNode = base.First;

            //update mobile on a lane one by one
            while (mobileNode != null)
            {
                var mobile = mobileNode.Value;
                //	mobile is possibaly deleted
                foreach (var Shap in mobile.Shape)
                {
                    if (Shap.Equals(opP))
                    {
                        return(true);
                    }
                }
                mobileNode = mobileNode.Next;
            }

            return(false);
            //-----------------------------------------------------------
        }
Пример #5
0
        void OnCrtBtnClick()
        {
            if (battleField.Contrller != null)
            {
                return;
            }
            Shap    shap     = new Shap(10f, 10f, 10f);
            Vector3 position = new Vector3(89.5f, 0f, 134f);
            int     unitCid  = 1;

            battleField.CrtUnit(unitCid, true, shap, position);
        }
Пример #6
0
        public static double GetArea(Shap s, int v2, int v3 = 0)
        {
            if (s == Shap.rectangle)
            {
                return(v2 * v3);
            }
            else if (s == Shap.triangle)
            {
                return(v2 * (v3 / 2));
            }
            else if (s == Shap.circle)
            {
                return(Math.PI * Math.Pow(v2, 2));  //3.14159 * v2*v2;
            }

            else
            {
                return(-1);
            }
        }
Пример #7
0
        public void CrtUnit(int unitCid, bool isControl, Shap shap, Vector3 position)
        {
            UnitCrtCmd crtCmd = new UnitCrtCmd(unitCid, isControl, runner.BattleField, shap, new common.game.battle.engine.Vector3(position.x, position.y, position.z));

            scene.CrtUnit(crtCmd);
        }
Пример #8
0
 public Unit(int cid, bool isControl, Shap shap) : this(cid, isControl, shap, new Vector3(0, 0, 0))
 {
 }
Пример #9
0
 public Unit(int cid, bool isControl, Shap shap, Vector3 bronPoint)
 {
     module = new logic.unit.Unit(cid, isControl, shap, bronPoint);
 }
Пример #10
0
 public DefaultUnit(int cid, bool isControl, Shap shap, Vector3 bronPoint) : base(cid, isControl, shap, bronPoint)
 {
 }