void MakeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
示例#2
0
    //    void OnTriggerEnter(Collider other){
    //        if (enabled && networkView.enabled && networkView.isMine && other.tag == "Road")
    //        {
    //            if(!carB)
    //                carB = GetComponent<CarB>();
    //            if(carB && carB.round == 3)
    //            {
    //                if(!gameState)
    //                    gameState = FindObjectOfType(typeof(PlayGameController)) as PlayGameController;
    //                if(!property)
    //                    property = GetComponent<CarProperty>();
    //                if(!carAI)
    //                    carAI = GetComponent<CarAI>();
    //                if(!isSendWin)
    //                {
    //                    if(gameState && !gameState.IsBalanceState()) {
    //                        networkView.enabled = false;
    //                        
    //                        gameState.SendWin(property.GetDriftTime(), property.GetUseEnergy(), property.GetBeHitTime(), property.ownerGUPID);
    //                        
    //                        isSendWin = true;
    //                    }
    //                    
    //                }
    //                carB.SetSteer(0);
    //                carB.SetThrottle(0);
    ////				carB.SetEnableUserInput(false);
    ////				Camera.main.GetComponent<UserInterfaceControl>().enabled = false;
    //                carB.Wait(true);
    //                carAI.enabled = false;
    //                property.SetShowRank(false);
    //            }
    //        }
    //    }
    void FinishRound()
    {
        if (enabled && networkView.enabled && networkView.isMine)
        {
            if(!gameState)
                gameState = FindObjectOfType(typeof(PlayGameController)) as PlayGameController;
            if(!property)
                property = GetComponent<CarProperty>();
            if(!carAI)
                carAI = GetComponent<CarAI>();
            if(!isSendWin)
            {
                if(gameState && !gameState.IsBalanceState()) {
                    networkView.enabled = false;

                    gameState.SendWin(property.GetDriftTime(), property.GetUseEnergy(), property.GetBeHitTime(), property.ownerGUPID);

                    isSendWin = true;
                }

            }
        //			carB.SetSteer(0);
        //			carB.SetThrottle(0);
        //				carB.SetEnableUserInput(false);
        //				Camera.main.GetComponent<UserInterfaceControl>().enabled = false;
        //			carB.Wait(true);
            carAI.enabled = false;
            property.SetShowRank(false);
        }
    }
示例#3
0
    // Use this for initialization
    void Start()
    {
        controller = FindObjectOfType(typeof(PlayGameController)) as PlayGameController;
        if(sprite.atlas.GetSprite(((Definition.eSceneID)controller.matchRoom.matchMap).ToString()) == null)
        {
            sprite.atlas = BGAtlas;
        }
        sprite.spriteName = ((Definition.eSceneID)controller.matchRoom.matchMap).ToString();

        int index = 0;
        foreach(GameUserPlayer player in controller.matchRoom.room.playersInRoom) {
            playerInfos[index].label.text = player.playerName;
            playerInfos[index].sprite.spriteName = ((Definition.eCarID)player.GetComponent<CarInsanityPlayer>().selectedCar.carID).ToString();
            index += 1;
        }
    }
示例#4
0
//        public static string GetFEN(UcChessBoard Board)
//        {
//            string FEN = "";
//
//            string strActiveSide = "";
//            string strCastling = "";
//            string strEnPassant = "-";
//            int intHalfMoveClock = Board.HalfMoveClock;
//            int intFullMoveNumBer = Board.FullMovesNumber;
//            string strPiecePlacemen = GetPiecePlacementString(Board._BoardState);
//
//            if (Board.WhiteToMove == true)
//                strActiveSide = "w";
//            else
//                strActiveSide = "b";
//
//            if (UcChessBoard._EnPassantPoint != new Point())
//            {
//                strEnPassant = Board.arrChessCell[UcChessBoard._EnPassantPoint.X, UcChessBoard._EnPassantPoint.Y].Name.ToLower();
//            }
//
//            if (UcChessBoard.KINGsideCastling == true)
//                strCastling += "K";
//
//            if (UcChessBoard.QUEENsideCastling == true)
//                strCastling += "Q";
//
//            if (UcChessBoard.kingsideCastling == true)
//                strCastling += "k";
//
//            if (UcChessBoard.queensideCastling == true)
//                strCastling += "q";
//
//            if (strCastling == "")
//                strCastling = "-";
//            FEN = strPiecePlacemen + " " + strActiveSide + " " + strCastling + " " + strEnPassant + " " + intHalfMoveClock + " " + intFullMoveNumBer;
//
//            return FEN;
//        }

        public static string GetFENWithoutMoveNumber(PlayGameController Board)
        {
            string FEN = "";

            string strActiveSide = "";
            string strCastling   = "";
            string strEnPassant  = "-";

            string strPiecePlacemen = GetPiecePlacementString(Board._BoardState);

            if (Board.isWhite == ChessSide.White)
            {
                strActiveSide = "w";
            }
            else
            {
                strActiveSide = "b";
            }

            if (Board._EnPassantPoint != new UnityEngine.Vector2())
            {
                strEnPassant = "ucchesscell";
            }

//            if (UcChessBoard.KINGsideCastling == true)
//                strCastling += "K";
//
//            if (UcChessBoard.QUEENsideCastling == true)
//                strCastling += "Q";
//
//            if (UcChessBoard.kingsideCastling == true)
//                strCastling += "k";
//
//            if (UcChessBoard.queensideCastling == true)
//                strCastling += "q";

            if (strCastling == "")
            {
                strCastling = "-";
            }
            FEN = strPiecePlacemen + " " + strActiveSide + " " + strCastling + " " + strEnPassant;

            return(FEN);
        }
 void Awake()
 {
     playerGameController = GameObject.FindObjectOfType(typeof(PlayGameController)) as PlayGameController;
     rediectController = GameObject.FindObjectOfType(typeof(RedirectController)) as RedirectController;
 }