Exemplo n.º 1
0
    /// <summary>
    /// Call this to release a worm
    /// </summary>
    public void SpawnWorm()
    {
        GameObject objCloned = AcquireClone();
        Worm       objWorm   = objCloned.GetComponent <Worm>();

        //removes the object clone from the parent area

        objCloned.transform.position = new Vector3
                                       (
            GetWormPositionBaseOnCamera().x,
            GetWormPositionBaseOnCamera().y,
            0f
                                       );

        objCloned.transform.rotation = Quaternion.identity;
        //initialize worm from the script
        objWorm.InitializeWorm();
        //add this worm to this pooler
        if (!listOfReleasedWorms.Contains(objWorm))
        {
            listOfReleasedWorms.Add(objWorm);
        }
    }