コード例 #1
0
    // Use this for initialization
    private void Start()
    {
        _instance = this;
        onPreferenceChange.AddListener(PreferenceChanged);
        rotationSlider.value = (int)LevelEditor.selectedObject.transform.rotation.eulerAngles.z;

        turret = LevelEditor.selectedObject.GetComponent <Turret>();
        if (turret != null)
        {
            fireRateSlider.value = turret.shotDelay;
        }
    }
コード例 #2
0
    // activates the properties menu that corresponds to the current selected object
    public static UIPreferenceMenu ShowMenu()
    {
        LevelObject.ObjectType type = LevelEditor.selectedObject.objectType;
        Debug.Log("type " + type + " - " + _instance);
        if (_instance != null)
        {
            UndoManager.AddUndoPoint();
            switch (type)
            {
            case LevelObject.ObjectType.turret:
                UITurretMenu.Activate(LevelEditor.CreateLevelData());
                UIPreferenceMenu.onPreferenceChange.Invoke(_instance.turretMenu);
                animator.ResetTrigger("showTurret");
                animator.ResetTrigger("hideTurret");
                animator.SetTrigger("showTurret");
                Debug.Log("treeehehee " + _instance.turretMenu);
                menuOpen       = true;
                openedMenuType = LevelObject.ObjectType.turret;
                return(_instance.turretMenu);

            case LevelObject.ObjectType.portal:
                UIPortalMenu.Activate(LevelEditor.CreateLevelData());
                UIPreferenceMenu.onPreferenceChange.Invoke(_instance.portalMenu);
                animator.ResetTrigger("showPortal");
                animator.SetTrigger("showPortal");
                menuOpen       = true;
                openedMenuType = LevelObject.ObjectType.portal;
                return(_instance.portalMenu);

            case LevelObject.ObjectType.attractor:
                UIAttractorMenu.Activate(LevelEditor.CreateLevelData());
                UIPreferenceMenu.onPreferenceChange.Invoke(_instance.attractorMenu);
                animator.ResetTrigger("showAttractor");
                animator.SetTrigger("showAttractor");
                menuOpen       = true;
                openedMenuType = LevelObject.ObjectType.attractor;
                return(_instance.attractorMenu);

            case LevelObject.ObjectType.speedStrip:
                UISpeedStripMenu.Activate(LevelEditor.CreateLevelData());
                UIPreferenceMenu.onPreferenceChange.Invoke(_instance.speedStripMenu);
                animator.ResetTrigger("showSpeedStrip");
                animator.ResetTrigger("hideSpeedStrip");
                animator.SetTrigger("showSpeedStrip");
                menuOpen       = true;
                openedMenuType = LevelObject.ObjectType.speedStrip;
                return(_instance.speedStripMenu);

            case LevelObject.ObjectType.bouncer:
                UIBouncerMenu.Activate(LevelEditor.CreateLevelData());
                UIPreferenceMenu.onPreferenceChange.Invoke(_instance.bouncerMenu);
                animator.ResetTrigger("showBouncer");
                animator.SetTrigger("showBouncer");
                menuOpen       = true;
                openedMenuType = LevelObject.ObjectType.bouncer;
                return(_instance.bouncerMenu);

            case LevelObject.ObjectType.finish:
                return(_instance.finishMenu);

            case LevelObject.ObjectType.spawn:
                return(_instance.spawnMenu);
            }
            Debug.Log("HERE");
        }
        return(null);
    }