public bool SpawnPacket(PacketAsset packetAsset) { if (Available) { packetToSpawn = packetAsset; return(true); } return(false); }
private void Tick() { if (!Available) { spriteIndex++; if (spriteIndex >= sprites.Length) { spriteIndex = 0; GameObject packetGo = Instantiate(packetPrefab, transform.position - transform.up, Quaternion.identity); Packet spawnedPacket = packetGo.GetComponent <Packet>(); spawnedPacket.packet = packetToSpawn; gm.AddSpawnedPacket(spawnedPacket); packetToSpawn = null; } sr.sprite = sprites[spriteIndex]; } }