Exemplo n.º 1
0
 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;
     }
 }
Exemplo n.º 2
0
 public SavedEnemy(Body enemyBody)
 {
     tilePos = new SavedTilePos(TerrainManager.PosToV2(enemyBody.gameObject.transform.position));
     index   = enemyBody.id;
     health  = enemyBody.health;
 }
Exemplo n.º 3
0
 public SavedResourceTile(TerrainManager.Tile tile)
 {
     tilePos       = new SavedTilePos(TerrainManager.PosToV2(tile.tile.transform.position));
     resourceIndex = ResourceInfo.GetIndexFromType(tile.resourceType);
 }
Exemplo n.º 4
0
 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
 }