Esempio n. 1
0
    public GameObject Spawn(string templateName, Vector2 position, float rotate, M8.GenericParams parms)
    {
        GameObject spawnGO = null;

        TemplateInfo template = null;

        for (int i = 0; i < templates.Length; i++)
        {
            if (templates[i].name == templateName)
            {
                template = templates[i];
                break;
            }
        }

        if (template != null)
        {
            mSpawnParms.Clear();

            mSpawnParms[JellySpriteSpawnController.parmPosition] = position;
            mSpawnParms[JellySpriteSpawnController.parmRotation] = rotate;

            mSpawnParms.Merge(parms, true);

            var spawn = mPool.Spawn(templateName, templateName, null, mSpawnParms);
            spawnGO = spawn.gameObject;
        }
        else
        {
            Debug.LogWarning("Template does not exists: " + templateName);
        }

        return(spawnGO);
    }