public void nextState() { if (myCell != null && myCell.nextSprite != null) { TheMap.UpdateCell(myCellNo, myCell.nextSprite.name, this); } }
public void step() { if (myCell != null) { switch (myCell.loot) { case LootType.PIRATE_WITH_SWORD: case LootType.PIRATE: Sounds.Play(SoundType.DIE); TheMap.PlayerDie(); break; case LootType.SCORE: Sounds.Play(SoundType.SCORE); TheMap.instance.Score += 3; TheMap.UpdateCell(myCellNo, myCell.nextSprite.name, this); break; case LootType.SWORD: Sounds.Play(SoundType.SCORE); Player.instance.HaveSword = true; TheMap.UpdateCell(myCellNo, myCell.nextSprite.name, this); break; case LootType.NONE: break; default: Debug.LogError("unknow loot " + myCell.loot.ToString()); break; } } }
// Попали ли во что-то мечём public hitType hit(bool isPlayer) { if (image.sprite.name == "empty") { return(hitType.NONE); } if (myCell != null) { switch (myCell.loot) { case LootType.PIRATE: case LootType.PIRATE_WITH_SWORD: if (isPlayer) { TheMap.UpdateCell(myCellNo, "empty", this); Sounds.Play(SoundType.DIE); return(hitType.PIRATE); } else { return(hitType.NONE); } break; case LootType.NONE: // хз что break; default: return(hitType.NONE); // через лут пролетает break; } } return(hitType.FOREST); }