/// <summary> /// Checks the block types for specified types, regardless of order /// </summary> /// <returns><c>true</c>, if block1 and block2 contain type1 and type2 <c>false</c> otherwise.</returns> /// <param name="block1">Block1.</param> /// <param name="block2">Block2.</param> /// <param name="type1">Block Type1.</param> /// <param name="type2">Block Type2.</param> bool BothBlocksEitherType(BlockType block1, BlockType block2, BlockType type1, BlockType type2) { bool firstCheck = block1.Equals(type1) && block2.Equals(type2); bool secondCheck = block1.Equals(type2) && block2.Equals(type1); bool result = firstCheck || secondCheck; return(result); }
public void SpawnFinishPoint(BlockType type) { if (!type.Equals(BlockType.FinishLocked) && !type.Equals(BlockType.FinishUnlocked)) { throw new ArgumentException("Invalid finish type parameter!"); } IGameObject finishPoint = new GameBlock(type, new Point3D(numberOfBlocks - 2, numberOfBlocks - 2, 1)); IGraphicsComponent portalObject = new GraphicsComponent(finishPoint, resourceManager, gameCanvas); gameMesh[numberOfBlocks - 2, numberOfBlocks - 2, 1] = portalObject; }
private static void handleAchievements(IBlock block, Mario mario) { BlockType type = block.returnBlockType(); if (type.Equals(BlockType.BrickCoin)) { AchievementEventTracker.hiddenDispenserAcievement(); } else if (type.Equals(BlockType.Brick) && ((!mario.Small) || (mario.Star))) { AchievementEventTracker.brickSmashedAcievement(); } else if (type.Equals(BlockType.QuestionCoin)) { AchievementEventTracker.questionCoinAcievement(); } }
private static void executeCollisionCommand(Mario mario, IBlock block, Game1 game) { BlockType type = block.returnBlockType(); ICommand command; if (type.Equals(BlockType.QuestionCoin)) { command = new MarioQuestionCoinBlockCollisionCommand(block, game); command.Execute(); } else if (type.Equals(BlockType.QuestionSuperMushroomFireFlower) && mario.Small && !mario.Fire) { command = new QuestionSuperMushroomCommand(block, game); command.Execute(); } else if (type.Equals(BlockType.QuestionSuperMushroomFireFlower) && !mario.Small) { command = new QuestionFireFlowerCommand(block, game); command.Execute(); } else if (type.Equals(BlockType.QuestionIceFlower)) { command = new QuestionIceFlowerCommand(block, game); command.Execute(); } else if (type.Equals(BlockType.QuestionStar)) { command = new QuestionStarCommand(block, game); command.Execute(); } else if (type.Equals(BlockType.Hidden)) { command = new MarioHiddenBlockCollisionCommand(block, game); command.Execute(); } else if (type.Equals(BlockType.BrickCoin)) { command = new BrickBlockDispenserCommand(mario, block, game); command.Execute(); } else if (type.Equals(BlockType.Brick) && ((!mario.Small) || (mario.Star))) { command = new BigMarioBrickBlockCollisionCommand(mario, block, game); command.Execute(); } }
public void DestroySelf() { if (!destroyed) { if (_type.isCollidable) { CreateDeathParticle(); } if (_type.Equals(BlockType.Bomb)) { CreateBombExplosion(); } destroyed = true; transform.position = faraway; UpdateBlocksInfo(); Destroy(gameObject, 0.0000001f); } }
public int blockTypeID(BlockType t) { //log("start", "blockTypeID(BlockType t)"); for (int i = 0; i < BlockTypes.Length; i++) { //log("comparing iterated type " + BlockTypes[i].GetHashCode() + " - " + BlockTypes[i].ToString() +" - " + BlockTypes[i].DisplayName, "blockTypeID(BlockType t)"); //log("to given type " + t.GetHashCode() + " - " + t.ToString() + " - " + t.DisplayName, "blockTypeID(BlockType t)"); if (t.Equals(BlockTypes[i])) { //log("they are equal!", "blockTypeID(BlockType t)"); return(i); } } log("BlockType not found! Pretending it's the first one.", "blockTypeID", Logger.severity.ERROR); return(0); }
public string Convert( ContentReference contentLink, BlockType fromBlockType, BlockType toBlockType, List <KeyValuePair <int, int> > propertyTypeMap, bool recursive, bool isTest) { if (ContentReference.IsNullOrEmpty(contentLink)) { throw new EPiServerException("Must specify a valid block, cannot be empty"); } if (fromBlockType == null) { throw new ArgumentNullException(nameof(fromBlockType)); } if (toBlockType == null) { throw new ArgumentNullException(nameof(toBlockType)); } if (fromBlockType.Equals(toBlockType)) { throw new EPiServerException("Can not convert to same block type"); } if (propertyTypeMap == null) { throw new ArgumentNullException(nameof(propertyTypeMap)); } StringBuilder stringBuilder = new StringBuilder(); DataSet ds = _dbAccessor().Convert(contentLink.ID, fromBlockType.ID, toBlockType.ID, propertyTypeMap, recursive, isTest); stringBuilder.Append(GenerateLogMessage(ds, contentLink.ID, fromBlockType.ID, toBlockType.ID, recursive, isTest)); if (!isTest) { stringBuilder.Append(RefreshPages(contentLink, recursive)); BlocksConverted?.Invoke(this, new ConvertedBlockEventArgs(contentLink, fromBlockType, toBlockType, recursive)); } return(stringBuilder.ToString()); }
public Blocks(int locX, int locY, BlockType type) { Vector2 location = new Vector2(locX, locY); if (type.Equals(BlockType.Brick)) { sprite = new BrickBlockSprite(location); } else if (type.Equals(BlockType.Ground)) { sprite = new GroundBlockSprite(location); } else if (type.Equals(BlockType.Hidden)) { sprite = new HiddenBlockSprite(location); } else if (type.Equals(BlockType.Platforming)) { sprite = new PlatformingBlockSprite(location); } else if (type.Equals(BlockType.Question)) { sprite = new QuestionBlockSprite(location); } else if (type.Equals(BlockType.BlueBrick)) { sprite = new BlueBrickBlockSprite(location); } else if (type.Equals(BlockType.BlueGround)) { sprite = new BlueGroundBlockSprite(location); } this.type = type; testForCollision = true; noLongerSpecialized = false; }
public bool Equals(Block block) { return(type.Equals(block.type)); }
/// <summary> /// Determine if either block is a certain type. /// </summary> /// <returns><c>true</c>, if either block is certain type, <c>false</c> otherwise.</returns> /// <param name="block1">Block1.</param> /// <param name="block2">Block2.</param> /// <param name="type">Type.</param> bool EitherBlockThisType(BlockType block1, BlockType block2, BlockType type) { bool result = block1.Equals(type) || block2.Equals(type); return(result); }