public static UIElement Shape(this ObjectCategory self) { Canvas shape; switch (self) { case ObjectCategory.ThunderstruckTree: shape = new Thunderstruck(); break; case ObjectCategory.HarvestableTree: shape = new Tree(false); break; case ObjectCategory.FruitedTree: shape = new Tree(true); break; //case ObjectCategory.Uprootable: shape = new Up(); break; case ObjectCategory.ScarecrowGarden: shape = new Garden(); break; case ObjectCategory.SmallHousing: shape = new SmallHouse(); break; case ObjectCategory.Farmhouse: shape = new Farmhouse(); break; case ObjectCategory.LargeHousing: shape = new LargeHouse(); break; case ObjectCategory.HarvestablePlant: shape = new Leaf(); break; case ObjectCategory.ScarecrowFarm: shape = new Farm(); break; case ObjectCategory.HousingWorkbench: shape = new HousingWorkbench(); break; case ObjectCategory.FriendlyPlayer: shape = new PlayerShape(true); break; case ObjectCategory.EnemyPlayer: shape = new PlayerShape(false); break; case ObjectCategory.FriendlyClipper: shape = new Clipper(true); break; case ObjectCategory.EnemyClipper: shape = new Clipper(false); break; case ObjectCategory.FriendlyMerchantShip: shape = new MerchantShip(true); break; case ObjectCategory.EnemyMerchantShip: shape = new MerchantShip(false); break; case ObjectCategory.FriendlyFishingBoat: shape = new FishingShip(true); break; case ObjectCategory.EnemyFishingBoat: shape = new FishingShip(false); break; case ObjectCategory.FriendlyGalleon: shape = new Galleon(true); break; case ObjectCategory.EnemyGalleon: shape = new Galleon(false); break; case ObjectCategory.FriendlyNPC: shape = new NpcShape(true); break; case ObjectCategory.TradePack: shape = new TradePack(); break; case ObjectCategory.Treasure: shape = new Treasure(); break; case ObjectCategory.FishSchool: shape = new Fish(); break; case ObjectCategory.EnemyNPC: shape = new NpcShape(false); break; default: Ellipse dot = DrawSimpleDot(); dot.Fill = self.Color(); return dot; } //need to flip the shape because our canvas is inverted (due to game coordinate system) return Flip(shape); }
void OnLand() { foreach (Coordinate c in playerShape.shapeCoordinates) { gameBoard[c.x, c.y] = BlockState.Block; } viewWindow.ShakeWindow(ArcadeWindow.ShakeWindowStrengh.Medium); playerShape = null; }
public void ClearRegistRenderManager() => render_manager_ = null; // limpa o render manager // metodos -------------------------------- #region Methods // altera a forma do jogador /// <summary> /// Switch the player shaper ///</summary> public void ChangeShape() { // atribui que o jogador esta a mudar de forma changing_state_ = true; // altera para a forma nao actual shape = (shape == PlayerShape.Aike) ? PlayerShape.Arif : PlayerShape.Aike; // caso exista um render manager registado if (render_manager_) { render_manager_.ChangeOccurred(shape); // envia que ocorreu uma alteraçao na forma } }
// confirma o comportamento a tomar com forme a forma para que foi alterado private void StateChecker(PlayerShape shape) { // determina a acçao de acordo com a forma inicial switch (shape) { case PlayerShape.Aike: // caso seja a forma de Aike EnableAike(); break; case PlayerShape.Arif: // caso seja a forma de Arif EnableArif(); break; } }
/** * Highlights the area where the shape currently selected can move */ void highlightMoveArea() { List <Vector3> lightedArea = new List <Vector3> (); List <Vector3> nextStep = new List <Vector3> (); List <Vector3> currStep = new List <Vector3> (); PlayerShape shape = (PlayerShape)GameObject.Find("Selected").GetComponentInChildren <PlayerShape> (); // First, get the neighbours of the shape's position nextStep = Pathing.neighbours(GameObject.Find("Selected").transform.position); // Iterate through found neighbours and save them as long as movement permits it for (int i = 0; i < shape.getMovement(); i++) { foreach (var tile in nextStep) { if (tile != GameObject.Find("Selected").transform.position&& !lightedArea.Contains(new Vector3(tile.x, tile.y - Constants.UNIT_TILE_DIFF, tile.z))) { currStep.AddRange(Pathing.neighbours(new Vector3(tile.x, tile.y, tile.z))); } } for (int j = 0; j < nextStep.Count; j++) // Sets every Y value to the tile level instead of unit level { nextStep[j] = new Vector3(nextStep[j].x, nextStep[j].y - Constants.UNIT_TILE_DIFF, nextStep[j].z); } lightedArea.AddRange(nextStep); nextStep = new List <Vector3>(currStep); currStep.Clear(); } // Highlight the identified tiles which can be moved to foreach (var tile in lightedArea) { foreach (GameObject current in GameObject.FindGameObjectsWithTag("Tile")) { if (tile == current.transform.position) { current.GetComponent <Renderer>().material.color = Constants.COLOR_MOVE_AREA; moveArea.Add(current.GetComponent <Tile>()); } } } }
// Start is called before the first frame update void Start() { soundController.setMute(true); rigidbody = GetComponent <Rigidbody2D>(); transform = GetComponent <Transform>(); rigidbody.freezeRotation = true; if (levelDefaultShape == null) { levelDefaultShape = squareAngles; } angleIndex = levelDefaultDirection; rotateClockwise = levelDefaultClockwise; currentShape = levelDefaultShape; setRotationAngles(currentShape); updateFacingDirection(); soundController.setMute(false); }
IEnumerator GameCoreRunner() { Init(); //Infinite Game Cycle while (isGaming) { //Spawn Player Shape playerShape = new PlayerShape(); playerShape.shapeCoordinates = TetrisShapes.GetShapeCoordinates(TetrisShapes.Shape.Random); playerShape.shapeCoordinates += new Coordinate(Mathf.RoundToInt(gameSize.x / 2), gameSize.y - 2); if (DetectIfCollideWithGameBoard(playerShape.shapeCoordinates)) { yield return(EditorCoroutineUtility.StartCoroutine(GameOverProcess(), ArcadeWindow.instance)); yield break; } double t = 0; while (playerShape != null) { t += deltaTime; if (t > FallFrequency) { t -= FallFrequency; t %= FallFrequency; FallDownPlayer(); } yield return(null); } BlockState[,] newBlockStates; bool isAnyMatchedLines = CheckMatch(out newBlockStates); gameBoard = newBlockStates; if (isAnyMatchedLines) { yield return(new EditorWaitForSeconds(1f)); ClearLine(); } } }
public void setRotationAngles(PlayerShape definition) { currentShape = definition; if (angleIndex >= currentShape.angles.Length) { angleIndex = 0; } else if (angleIndex < 0) { angleIndex = currentShape.angles.Length - 1; } spriteSwitcher.setShapeSprites(definition); spriteSwitcher.setActiveDirection(angleIndex); spriteSwitcher.updateSprite(); eyeController.pupilLookAt(angleRad, 1f); characterShadow.setShape(definition.type); eyeController.blink(); soundController.onChangeShape(); }
public void SetPlayerShape(bool changeToBall, bool changeToSquare, bool changeSquat) { //Debug.Log(_SquatingKeyReset.ToString()+" "+PlayerShape.ToString()+" "+changeToBall.ToString()+" "+changeToSquare.ToString()); changeSquat &= _SquatingKeyReset; if (HaveLearnedChangeShape) { switch (_PlayerShape) { case PlayerShape.Ball: if (changeToBall is false && changeToSquare is true) { _PlayerShape = PlayerShape.Square; _ChangeToSquare = true; changeSquat = (_IsSquating); } break; case PlayerShape.Square: if (changeToSquare is false && changeToBall is true) { _PlayerShape = PlayerShape.Ball; _ChangeToBall = true; changeSquat = (_IsSquating); } break; } } // 处理缩脚 if (changeSquat && HaveLearnedSquat) { changeSquating(); } }
public void setShapeSprites(PlayerShape shape) { activeShape = shape; isDirty = true; }
public void setSpawnShape(PlayerShape shape, int direction = 0, bool clockwise = true) { levelDefaultShape = shape; levelDefaultDirection = direction; levelDefaultClockwise = clockwise; }
// funçao disperta sempre que o jogador muda de estado public void ChangeOccurred(PlayerShape toShape) => StateChecker(toShape);
public Player(string name, PlayerShape shape, PlayerColor color) { Name = name; Shape = shape; Color = color; }