Example #1
0
    public void SetPlayerPosition(Vector3 position)
    {
        // HACK - APPEARS TO BE UNNECESSARY NOW FOR [INSERT DARK MAGIC REASONS HERE].
        float playerHeightOffset = 0f;

        float terrainHeight = LevelHelpers.GetTerrainHeightAtWorldPos(position);

        PlayArea.position = new Vector3(position.x, terrainHeight + playerHeightOffset, position.z);
    }
Example #2
0
    public void Start()
    {
        int amount = Random.Range(2, 5);

        float radius = 15;

        for (int i = 0; i < amount; i++)
        {
            Vector2 offset   = radius * Random.insideUnitCircle;
            Vector3 spawnPos = transform.position;
            spawnPos.x = spawnPos.x + offset.x;
            spawnPos.z = spawnPos.z + offset.y;
            spawnPos.y = LevelHelpers.GetTerrainHeightAtWorldPos(spawnPos);

            GameObject.Instantiate(goblin, spawnPos, Quaternion.identity);
        }
    }
Example #3
0
    public void SpawnStartingMinions(int num, Vector3 centerPosition)
    {
        float interval = (2 * Mathf.PI) / num;

        for (int i = 0; i < num; ++i)
        {
            float angle = interval * i;

            float x = MinionSpawnDistance * Mathf.Cos(angle);
            float z = MinionSpawnDistance * Mathf.Sin(angle);
            float y = LevelHelpers.GetTerrainHeightAtWorldPos(new Vector3(x, 0f, z));

            Vector3 position = (new Vector3(x + centerPosition.x, y, z + centerPosition.z));

            MinionManager.Instance.SpawnMinion(position);
        }
    }