示例#1
0
        public Models.PlayerViewModel GetInitialData(GameObject go)
        {
            var data = playerFunctions.GetDataByInitialPosition(go.transform.position);

            if (data == null)
            {
                data          = DAL.MVC_Game2Context.defaultPlayer;
                data.InitialX = go.transform.position.x;
                data.InitialY = go.transform.position.y;
                playerFunctions.Create(data);
            }
            id = data.PlayerId;
            var model = playerFunctions.GetDataViewModel(data);

            model.GameObject = go;
            playerFunctions.SetModel(model);
            return(model);
        }
示例#2
0
        public Models.PlayerViewModel GetInitialData(int id, GameObject go)
        {
            var data = playerFunctions.GetDataById(id);

            //if (data == null)
            //{
            //    //data = DAL.ProjectVikingsContext.defaultPlayer;
            //    //data.InitialX = go.transform.position.x;
            //    //data.InitialY = go.transform.position.y;
            //    //playerFunctions.Create(data);
            //}
            var model = playerFunctions.GetDataViewModel(data);

            model.GameObject       = go;
            this.id                = playerFunctions.SetModel(model);
            model.InternalPlayerId = this.id;
            return(model);
        }