Beispiel #1
0
    private GameObject GenerateMovingPlatform(GameObject block)
    {
        ParentBlocks();
        Vector3    endPoint           = block.transform.position + new Vector3(UnityEngine.Random.value * 30, UnityEngine.Random.value * 1, UnityEngine.Random.value * 30);
        GameObject parent             = block.transform.parent.gameObject;
        DynamicEnvironmentElement dyn = parent.AddComponent <DynamicEnvironmentElement>();

        dyn.translationWaypoints = new List <Vector3>();
        dyn.translationWaypoints.Add(endPoint);
        dyn.waypointCyclingVelocity  = UnityEngine.Random.value * 6f;
        dyn.requiredWaypointAccuracy = dyn.waypointCyclingVelocity / 10f;
        GameObject temp = Instantiate(_2x2Block);

        temp.transform.position = endPoint;
        return(temp);
    }
Beispiel #2
0
    private void GenerateRotatingPlatform(GameObject block)
    {
        foreach (Vector3 v in rotatingPlatformLocations)
        {
            if (Vector3.Distance(v, block.transform.position) < 30)
            {
                return;
            }
        }
        rotatingPlatformLocations.Add(block.transform.position);
        ParentBlocks();
        GameObject parent             = block.transform.parent.gameObject;
        DynamicEnvironmentElement dyn = parent.AddComponent <DynamicEnvironmentElement>();
        float rotationCoefficient     = UnityEngine.Random.value * 10;

        dyn.rotPerSecond         = new Vector3((UnityEngine.Random.value - 0.5f) * rotationCoefficient, (UnityEngine.Random.value - 0.5f) * rotationCoefficient, (UnityEngine.Random.value - 0.5f) * rotationCoefficient);
        dyn.translationWaypoints = new List <Vector3>();
    }