Exemple #1
0
    public bool SpawnPacket(PacketAsset packetAsset)
    {
        if (Available)
        {
            packetToSpawn = packetAsset;
            return(true);
        }


        return(false);
    }
Exemple #2
0
    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];
        }
    }