public SavedPickup(Pickup pickup) { tilePos = new SavedTilePos(pickup.position); if (pickup is ResourcePickup) { ResourcePickup resourcePickup = pickup as ResourcePickup; pickupType = 0; index = resourcePickup.info.ToIndex(); stackHeight = pickup.gameObjects.Count; } else if (pickup is WeaponPickup) { WeaponPickup weaponPickup = pickup as WeaponPickup; pickupType = 1; index = weaponPickup.info.ToIndex(); stackHeight = 1; } else if (pickup is AugmentPickup) { AugmentPickup augmentPickup = pickup as AugmentPickup; pickupType = 2; index = augmentPickup.info.ToIndex(); stackHeight = 1; } else { Debug.LogError("Unrecognized pickup type"); pickupType = -1; index = -1; stackHeight = -1; } }
public SavedEnemy(Body enemyBody) { tilePos = new SavedTilePos(TerrainManager.PosToV2(enemyBody.gameObject.transform.position)); index = enemyBody.id; health = enemyBody.health; }
public SavedResourceTile(TerrainManager.Tile tile) { tilePos = new SavedTilePos(TerrainManager.PosToV2(tile.tile.transform.position)); resourceIndex = ResourceInfo.GetIndexFromType(tile.resourceType); }
public void Init(Building building) { tilePos = new SavedTilePos(TerrainManager.PosToV2(building.transform.position)); index = Crafting.instance.buildingInfos.IndexOf(building.info); //TODO: to prevent trolls we'll probably also need to store the turns before the next spawn but for now it's low priority }