示例#1
0
    IEnumerator EjectBlob()
    {
        yield return(new WaitForEndOfFrame());

        Vector2 ejectPos = new Vector2(currentPlayer.transform.position.x, currentPlayer.transform.position.y + (currentPlayer.myJelly.m_SpriteScale.y));

        JellyBlob blob = Instantiate(blobPrefab, ejectPos, Quaternion.identity) as JellyBlob;

        yield return(new WaitForEndOfFrame());

        blob.Jump(true);
    }
示例#2
0
    void SpawnABlobAtFurthestSpawnPoint()
    {
        Vector2        playerPos            = PM.currentPlayer.transform.position;
        List <Vector2> availableSpawnPoints = new List <Vector2>();

        foreach (Transform child in this.transform)
        {
            if (Vector2.Distance(playerPos, child.transform.position) > noFromPlayerRadius)
            {
                availableSpawnPoints.Add(child.transform.position);
            }
        }
        int randSeed = Random.Range(0, availableSpawnPoints.Count);

        print(randSeed);
        Vector2 spawnPoint = availableSpawnPoints[randSeed];

        print(spawnPoint);
        if (spawnPoint != null)
        {
            JellyBlob blob = Instantiate(blobPrefab, spawnPoint, Quaternion.identity) as JellyBlob;
        }
    }
示例#3
0
    void SpawnABlobAnywhere()
    {
        Vector2 spawnPos = GetRandomPosInArea();

        JellyBlob blob = Instantiate(blobPrefab, spawnPos, Quaternion.identity) as JellyBlob;
    }