Example #1
0
    void SpawnNodeEnv(NodeV2 tile, GameObject envPrefab)
    {
        Vector3    envPos = tile.gameObject.transform.position + tile.GetEnvOffset();
        Quaternion envRot = Quaternion.identity;

        // Random 90 deg rotation
        int envAngle = (int)(m_orientationOddsTable.GetPayload(m_orientationOddsTable.Roll()));

        envRot = Quaternion.AngleAxis(envAngle, Vector3.up);

        GameObject spawnedEnv = Instantiate(envPrefab, envPos, envRot, this.gameObject.transform);

        // Set reference so it can be deleted
        tile.SetEnvObject(spawnedEnv);
    }