コード例 #1
0
 protected override void Execute(LevelStateChanged msg)
 {
     if (map.NumOfJumpables == 1 && !_spawned && map.IsJumpable(new TilePoint(gameObject)))
     {
         Instantiate(dataCube, transform);
         _spawned = true;
     }
 }
 protected override void Execute(LevelStateChanged msg)
 {
     if (map.NumOfJumpables == 1 && !_spawned)
     {
         var heroTile = new TilePoint(map.Hero.gameObject);
         if (map.IsJumpable(new TilePoint(heroTile.X - 1, heroTile.Y)) && map.IsWalkable(new TilePoint(heroTile.X - 2, heroTile.Y)))
         {
             SpawnDataCube(new TilePoint(heroTile.X - 2, heroTile.Y));
         }
         if (map.IsJumpable(new TilePoint(heroTile.X + 1, heroTile.Y)) && map.IsWalkable(new TilePoint(heroTile.X + 2, heroTile.Y)))
         {
             SpawnDataCube(new TilePoint(heroTile.X + 2, heroTile.Y));
         }
         if (map.IsJumpable(new TilePoint(heroTile.X, heroTile.Y - 1)) && map.IsWalkable(new TilePoint(heroTile.X, heroTile.Y - 2)))
         {
             SpawnDataCube(new TilePoint(heroTile.X, heroTile.Y - 2));
         }
         if (map.IsJumpable(new TilePoint(heroTile.X, heroTile.Y + 1)) && map.IsWalkable(new TilePoint(heroTile.X, heroTile.Y + 2)))
         {
             SpawnDataCube(new TilePoint(heroTile.X, heroTile.Y + 2));
         }
     }
 }
コード例 #3
0
 private bool IsConditionMet(TutorialCondition condition)
 {
     if (condition.Type == TutorialConditonType.RootPresent)
     {
         return(new TilePoint(map.Hero).Equals(condition.TilePoint) == condition.IsTrue);
     }
     if (condition.Type == TutorialConditonType.SubroutinePresent)
     {
         return(map.IsJumpable(condition.TilePoint) == condition.IsTrue);
     }
     if (condition.Type == TutorialConditonType.PieceSelected)
     {
         return(condition.IsTrue
             ? selectedPiece.Selected.IsPresentAnd(x => new TilePoint(x).Equals(condition.TilePoint))
             : !selectedPiece.Selected.IsPresent || !new TilePoint(selectedPiece.Selected.Value).Equals(condition.TilePoint));
     }
     if (condition.Type == TutorialConditonType.LevelHasReset)
     {
         return(hasLevelReset.Value == condition.IsTrue);
     }
     return(false);
 }
コード例 #4
0
 public override bool IsPossible(MoveToRequested m) => m.To.InBetween(m.From).Count == 1 && map.IsJumpable(m.To.InBetween(m.From)[0]);