public GameScreen(Map gameMap, APlayer a, BPlayer b, CPlayer c, DPlayer d, Form menuForm) { this.menuForm = menuForm; map = gameMap; aPlayer = a; bPlayer = b; cPlayer = c; dPlayer = d; goldImages = new Image[4]; hiddenGoldImages = new Image[4]; cordNumberGuide = (squareEdge * 3) / 4; goldImages[0] = global::AltınOyunuCSharp.Properties.Resources.coin5; goldImages[1] = global::AltınOyunuCSharp.Properties.Resources.coin10; goldImages[2] = global::AltınOyunuCSharp.Properties.Resources.coin15; goldImages[3] = global::AltınOyunuCSharp.Properties.Resources.coin20; hiddenGoldImages[0] = global::AltınOyunuCSharp.Properties.Resources.hiddenCoin5; hiddenGoldImages[1] = global::AltınOyunuCSharp.Properties.Resources.hiddenCoin10; hiddenGoldImages[2] = global::AltınOyunuCSharp.Properties.Resources.hiddenCoin15; hiddenGoldImages[3] = global::AltınOyunuCSharp.Properties.Resources.hiddenCoin20; aPlayerImage = global::AltınOyunuCSharp.Properties.Resources.playerA_front; bPlayerImage = global::AltınOyunuCSharp.Properties.Resources.playerB_front; cPlayerImage = global::AltınOyunuCSharp.Properties.Resources.playerC_front; dPlayerImage = global::AltınOyunuCSharp.Properties.Resources.playerD_front; InitializeComponent(); }
/// <summary> /// Actualiza todos los objetos que estan activos actualmente en escena /// </summary> private void UpdateActive(bool playableLevel) { activeEnemies.Clear(); activeWalls.Clear(); activeTerminals.Clear(); activeDoors.Clear(); if (playableLevel) { // Guardamos los enemigos activeEnemies.AddRange(activeBoard.GetBoardEnemies()); // Guardamos los muros activeWalls.AddRange(activeBoard.GetBoardWalls()); // Guardamos las terminales activeTerminals.AddRange(activeBoard.GetBoardTerminals()); // Guardamos las puertas activeDoors.AddRange(activeBoard.GetBoardDoors()); } // Guardamos el jugador activePlayer = activeBoard.GetPlayer(); // Guardamos la camara activeCamera = activeBoard.GetCamera(); }
// Start is called before the first frame update void Start() { player = FindObjectOfType <BPlayer>(); rb = GetComponent <Rigidbody2D>(); trail = GetComponentInChildren <TrailRenderer>(); coinTextLabel.text = ""; // "+1" }
public ScoreBoard(APlayer aPlayer, BPlayer bPlayer, CPlayer cPlayer, DPlayer dPlayer, Map map, Form gameForm) { this.aPlayer = aPlayer; this.bPlayer = bPlayer; this.cPlayer = cPlayer; this.dPlayer = dPlayer; this.map = map; this.gameForm = gameForm; InitializeComponent(); }
public void GameOver(BPlayer player) { CleanUp(); uiText.gameObject.SetActive(false); gameOverText.gameObject.SetActive(true); gameOverSummary.gameObject.SetActive(true); gameOverSummary.text = "Score: " + ui.Coins + "\nTime: " + (DateTime.Now - startTime).ToString(@"hh\:mm\:ss\.fff") + "\nMax Combo: " + ui.MaxCombo + "\n\n Press Enter to restart" + "\nL=Credits" ; sound.PlayOneShot(gameOverSound); gameIsOver = true; }
private void StartGame_Click(object sender, EventArgs e) { this.Hide(); int cordX = Int32.Parse(CordXNum.Text); int cordY = Int32.Parse(CordYNum.Text); int costA = Int32.Parse(aCostNum.Text); int costB = Int32.Parse(bCostNum.Text); int costC = Int32.Parse(cCostNum.Text); int costD = Int32.Parse(dCostNum.Text); int targetCostA = Int32.Parse(aTargetCostNum.Text); int targetCostB = Int32.Parse(bTargetCostNum.Text); int targetCostC = Int32.Parse(cTargetCostNum.Text); int targetCostD = Int32.Parse(dTargetCostNum.Text); int moveLenght = Int32.Parse(MoveLenghtNum.Text); int goldRate = Int32.Parse(GoldNum.Text); int privateGoldRate = Int32.Parse(PrivateGoldNum.Text); int startGold = Int32.Parse(StartGoldNum.Text); int cGoldShow = Int32.Parse(cGoldShowNum.Text); //Map Oluşturma this.map = new Map(cordY, cordX); // Player Modelleri // this.aPlayer = new APlayer(startGold, "A", 0, 0, costA, moveLenght, targetCostA, cordY, cordX); this.bPlayer = new BPlayer(startGold, "B", 0, (cordX - 1), costB, moveLenght, targetCostB, cordY, cordX); this.cPlayer = new CPlayer(startGold, "C", (cordY - 1), 0, costC, moveLenght, cGoldShow, targetCostC, cordY, cordX); this.dPlayer = new DPlayer(startGold, "D", (cordY - 1), (cordX - 1), costD, moveLenght, targetCostD, cordY, cordX); // Map Player Yerleşimi this.map.AddPlayer(0, 0, "A"); //Player A this.map.AddPlayer(0, (cordX - 1), "B"); //Player B this.map.AddPlayer((cordY - 1), 0, "C"); //Player C this.map.AddPlayer((cordY - 1), (cordX - 1), "D"); //Player D //Map Altın Yerleşimi this.map.AddAllGold(goldRate, privateGoldRate); GameScreen game = new GameScreen(this.map, this.aPlayer, this.bPlayer, this.cPlayer, this.dPlayer, this); game.Show(); }
/// <summary> /// Funcion encargada de hacer el Setup del Board iniciando todas sus estructuras logicas /// </summary> /// <param name="manager">Manager del cubo</param> /// <param name="playableLevel">Indica si el nivel es de paso o de juego</param> public void SetupBoard(BGameManager manager, bool playableLevel) { // GUardamos el manager gameManager = manager; // Primero observamos el sistema de coordenadas que vamos a utilizar // El sistema elegido dependera de las coordenadas que provengan del boardInfo if (boardInfo.x && boardInfo.y) { coordSys = ECord.XY; } else if (boardInfo.x && boardInfo.z) { coordSys = ECord.XZ; } else if (boardInfo.y && boardInfo.z) { coordSys = ECord.YZ; } else { Debug.LogError("Por favor indique en la informacion del tablero dos coordenadas para el systema de coordenadas"); } // Obtenemos el tamaño de la casilla base y lo guardamos para usarlo mas tarde Vector3 tileSize = Tile.GetComponent <Renderer>().bounds.size; tileSize1 = (int)tileSize.x; tileSize2 = (int)tileSize.z; tileSize3 = tileSize.y; // Obtenemos todas las casillas de la escena activas Object[] boardTiles = GetComponentsInChildren <BTile>(); // Obtenemos la coordenada de la superficie para poder spawnear particulas mas tarde en esta BTile aux = (BTile)boardTiles[0]; switch (coordSys) { case ECord.XY: surfaceCoord = aux.gameObject.transform.position.z + aux.transform.up.z * tileSize3 / 2; break; case ECord.XZ: surfaceCoord = aux.gameObject.transform.position.y + aux.transform.up.y * tileSize3 / 2; break; case ECord.YZ: surfaceCoord = aux.gameObject.transform.position.x + aux.transform.up.x * tileSize3 / 2; break; default: break; } // A partir de todas estas casillas obtenemos sus posiciones en el sistema List <float> firstPositions = new List <float>(); List <float> secondPositions = new List <float>(); foreach (BTile item in boardTiles) { // Dependiendo del sistema de coordenadas guardamos unos valores diferentes switch (coordSys) { case ECord.XY: firstPositions.Add(item.gameObject.transform.position.x); secondPositions.Add(item.gameObject.transform.position.y); break; case ECord.XZ: firstPositions.Add(item.gameObject.transform.position.x); secondPositions.Add(item.gameObject.transform.position.z); break; case ECord.YZ: firstPositions.Add(item.gameObject.transform.position.y); secondPositions.Add(item.gameObject.transform.position.z); break; default: break; } } // Guardamos la posicion minima para usarla mas tarde min1 = firstPositions.Min(); min2 = secondPositions.Min(); max1 = firstPositions.Max(); max2 = secondPositions.Max(); // Calculamos el tamaño del tablero a partir de las posiciones y de los tamaños size1 = Mathf.RoundToInt((max1 - min1) / tileSize1) + 1; size2 = Mathf.RoundToInt((max2 - min2) / tileSize2) + 1; // Spawneamos el plano de collision para detectar los clicks SpawnCollisionPlane(); // Premaramos el diccionario con las diferentes direcciones indexDirections.Add("Up", size1); indexDirections.Add("Down", -size1); indexDirections.Add("Left", -1); indexDirections.Add("Right", 1); //Para cada casilla almacenamos su posicion y como referente guardamos su indice en el array foreach (BTile item in boardTiles) { //Calculamos el nuevo indice para guardar en el diccionario de localizaciones Vector3 position = item.gameObject.transform.position; int firstIndex = 0; int secondIndex = 0; switch (coordSys) { case ECord.XY: // Calculamos los indices respecto a las posiciones firstIndex = Mathf.RoundToInt((position.x - min1) / tileSize1); secondIndex = Mathf.RoundToInt((position.y - min2) / tileSize2) * size1; // Guardamos en el diccionario el index con su respectiva posicion locations.Add((firstIndex + secondIndex), new Vector2(position.x, position.y)); tiles.Add((firstIndex + secondIndex), item); break; case ECord.XZ: // Calculamos los indices respecto a las posiciones firstIndex = Mathf.RoundToInt((position.x - min1) / tileSize1); secondIndex = Mathf.RoundToInt((position.z - min2) / tileSize2) * size1; // Guardamos en el diccionario el index con su respectiva posicion locations.Add((firstIndex + secondIndex), new Vector2(position.x, position.z)); tiles.Add((firstIndex + secondIndex), item); break; case ECord.YZ: // Calculamos los indices respecto a las posiciones firstIndex = Mathf.RoundToInt((position.y - min1) / tileSize1); secondIndex = Mathf.RoundToInt((position.z - min2) / tileSize2) * size1; // Guardamos en el diccionario el index con su respectiva posicion locations.Add((firstIndex + secondIndex), new Vector2(position.y, position.z)); tiles.Add((firstIndex + secondIndex), item); break; default: break; } //Guardamos el indice de la casilla inicial y final if (item.currentState == BTile.ETileState.Start) { startIndex = firstIndex + secondIndex; } else if (item.currentState == BTile.ETileState.End) { endIndex.Add(firstIndex + secondIndex); } } // Para cada casilla almacenamos sus bordes usando como referente su indice en el array foreach (int index in locations.Keys) { // Llamamos a la funcion CreateLocalEdges que nos devuelve los bordes del indice edges.Add(index, CreateLocalEdges(index)); } // Añadimos los bordes de las paredes AddWallsEdges(); // Ponemos a 0 los bordes del tablero SetBorderEdges(); // Obtenemos la posicion y rotacion para instanciar al jugador Vector3 playerPos = GetPlayerSpawnPos(boardInfo.player.GetComponent <Renderer>().bounds.size.y); Quaternion playerRot = GetPlayerSpawnRot(); // Instanciamos al jugador GameObject playerGO = Instantiate(boardInfo.player, playerPos, playerRot); // Obtenemos el script del jugador y lo guardamos player = playerGO.GetComponent <BPlayer>(); player.transform.parent = this.transform; // Hacemos el setup del jugador player.SetupPlayer(manager, playerInfo, endIndex); // Obtenemos la roatacion de los elementos del tablero para cuando spawneemos particulas spawnRotation = player.transform.rotation; if (playableLevel) { // Obtenemos todos los enemigos y los guardamos en la lista foreach (BEnemy enemy in GetComponentsInChildren <BEnemy>()) { enemy.SetupEnemy(manager); enemiesPos.Add(enemy.GetEnemyIndex()); } // Iniciamos las puertas del nivel foreach (BPuerta puerta in GetComponentsInChildren <BPuerta>()) { puerta.SetupDoor(manager); } foreach (BTerminal terminal in GetComponentsInChildren <BTerminal>()) { terminal.SetupTerminal(manager); } foreach (BBaliza baliza in GetComponentsInChildren <BBaliza>()) { baliza.SetupBaliza(manager); } } else { // Obtenemos todos los enemigos y los desactivamos foreach (BEnemy enemy in GetComponentsInChildren <BEnemy>()) { enemy.EndEnemy(); } } // Spawneamos el target de la camara y lo colocamos en el centro GameObject target = new GameObject("Camera Target"); target.transform.position = Vector3.zero; target.transform.rotation = Quaternion.identity; target.transform.parent = this.transform; // Instanciamos la camara GameObject cameraGO = Instantiate(boardInfo.camera, cameraInfo.position, Quaternion.Euler(cameraInfo.rotation)); cameraGO.transform.parent = target.transform; // Guardamos el script de la camara camera = cameraGO.GetComponent <BCameraController>(); // Ejecutamos el Setup camera.SetupCamera(manager, cameraInfo); }
// PUT api/<controller>/5 public BPlayer PutPlayer(int id, BPlayer value) { return playerService.CreateOrUpdate(value); }
// POST api/<controller> public BPlayer PostPlayer(BPlayer value) { return playerService.CreateOrUpdate(value); }
// Start is called before the first frame update void Start() { player = FindObjectOfType <BPlayer>(); }
// Start is called before the first frame update void Start() { ui = GameObject.FindObjectOfType <BUI>(); player = FindObjectOfType <BPlayer>(); }
public static MSMessageBase GetEmptyMessageById(int id) { MSMessageBase msg = null; switch (id) { case 102: msg = new BVector2(); break; case 103: msg = new BVector3(); break; case 101: msg = new BPlayer(); break; case 1001: msg = new CSLogin(); break; case 1003: msg = new SCJoinGame(); break; case 1004: msg = new SCLogin(); break; case 1005: msg = new SCGameSync(); break; case 2001: msg = new CSMove(); break; case 2002: msg = new SCMove(); break; case 2003: msg = new CSJump(); break; case 2004: msg = new SCJump(); break; case 2005: msg = new CSDash(); break; case 2006: msg = new SCDashStart(); break; case 2007: msg = new SCDashStop(); break; default: break; } return(msg); }
void Awake() { MainPlayer = this; }
public void Init(BPlayer player) { _player = player; }
public async Task EditPlayer(BPlayer player) { var playerD = player.Adapt <DPlayer>(); await this.playerService.EditPlayer(playerD); }