Ejemplo n.º 1
0
    public void FillValues(int index, PlatformSettings platformInfo)
    {
        platformIndexText.text  = "#" + index;
        platformType.value      = (int)platformInfo.GetPlatformType();
        isMovable.isOn          = platformInfo.IsThePlatformMovable();
        directionToChange.value = (int)platformInfo.GetDirectionToChange();
        directionToMove.value   = (int)platformInfo.GetDirectionToMove();
        unitsToMove.value       = platformInfo.GetUnitsToMove() - 1; //1-3 to 0-2 Range conversion
        objectAttached.value    = (int)platformInfo.GetObjectAttached();

        UpdatePanels();
    }
Ejemplo n.º 2
0
    public void CreateNewPlatform(PlatformSettings newPlatformSettings)
    {
        if (platformReferences[selectedPlatformIndex] != null)
        {
            Vector3 position = platformPositions[selectedPlatformIndex];
            Destroy(platformReferences[selectedPlatformIndex]);

            /*The Manager creates a platform based on the platform types's enum value,
             *  interpreting it as an index from its array of platforms*/
            GameObject g = Instantiate(platformPool[(int)newPlatformSettings.GetPlatformType()],
                                       position, Quaternion.identity);
            g.transform.localScale = platformsScale;

            //NOTE: Add Object Attached (make g a parent of said object if aplicable)

            //Set the corresponding properties of the platform specified in the config file
            if (newPlatformSettings.GetPlatformType() == PlatformType.DirectionChanger)
            {
                g.GetComponent <DirectionChangerPlatform>().SetSettings(newPlatformSettings);
            }

            //Add the Moving Platform's properties to the created platform if aplicable
            if (newPlatformSettings.IsThePlatformMovable())
            {
                g.AddComponent <MovingPlatform>().SetSettings(newPlatformSettings);
            }
            g.transform.parent = stage.transform;
            platformReferences[selectedPlatformIndex] = g;

            levelSelected.layoutPlatforms[selectedPlatformIndex] = newPlatformSettings;
        }
        else
        {
            Debug.Log("There is no Platform Selected");
        }
    }