private bool SlugTOInteraction(Slug slug, Vec2i pos, bool sliding = true, bool useTeleports = true) { foreach (var to in currLvl.Map.GetTOAtPos(pos)) { var result = to.PlayerEntered(); Log("PlayerTOInteraction - sliding: " + sliding + ", result.type: " + result.type); switch (result.type) { case TileObjectInteractionResultType.Kill: LoseLevel(); return(true); case TileObjectInteractionResultType.Teleport: //Debug.LogError("CURRENTLY NOT WORKING - TODO!"); //Set Player position, interact with end tile //playerPos = result.position; //playerObj.transform.position = (Vector3)GameHelper.TileToWorldPos(result.position) + currLvl.transform.position; if (useTeleports) { slug.SetPosition(result.pos); } // interact with end tile //if (PlayerTileInteraction()) return true; break; case TileObjectInteractionResultType.PickupColor: slug.SetColor(result.color); currLvl.Map.DeleteTOAtPos(pos, to); break; case TileObjectInteractionResultType.Exit: if (!sliding) { Log("Slug on exit - exit color: " + ((ExitDefinition)to.ToDef).color + ", slug color: " + slug.color); if (((ExitDefinition)to.ToDef).color == TileColor.None || ((ExitDefinition)to.ToDef).color == slug.color) { slug.isOnExit = true; if (GameRules.RemoveSlugsWhenTouchExit) { slugList.Remove(slug); Destroy(slug.gameObject); } bool allSlugsOnExit = true; foreach (var otherSlug in slugList) { if (!otherSlug.isOnExit) { allSlugsOnExit = false; } } if (allSlugsOnExit) { WinLevel(); return(true); } } } break; default: break; } //if (result.kill) //if (to.GetType() == typeof(Spikes)) { // SpikesDefintion spikesDef = (SpikesDefintion)to.ToDef; // if (spikesDef.isRaised) { // LoseLevel(); // return true; // } //} } return(false); }