Ejemplo n.º 1
0
    void Awake()
    {
        //basic singleton stuff-- make sure there's only one instance, and it's this one!
        if (Instance == null)
        {
            Instance = this;               //there is no PlayerManager-- so this can be it
            DontDestroyOnLoad(gameObject); //pls don't destroy thanks
            index           = 0;
            AvailableColors = new List <ColorIDs.Colors>();
            AvailableColors.Add(ColorIDs.Colors.NONE);
            CurrentColor = AvailableColors[index];
            //for testing color switching: give us all colors
            if (giveDebugColors)
            {
                AddColor(ColorIDs.Colors.Green);
                AddColor(ColorIDs.Colors.Blue);
                AddColor(ColorIDs.Colors.Red);
            }
        }
        else
        {
            Destroy(gameObject); //ok there's already a PlayerManager. so die
        }

        //on Awake, find the player
        player = GameObject.FindWithTag("Player");

        //The following block is for loading a scene's data when restarting it

        //we have a LoadSceneData and its scene number is the same as our scene
        if (lsd != null && lsd.sceneName == LevelManager.CurrentSceneName)
        {
            //so we must be reloading this scene-- let's set all this data back
            //to where it was when we started this scene!
            CurrentColor = lsd.saved_CurrentColor;
            AvailableColors.Clear();
            foreach (ColorIDs.Colors c in lsd.saved_AvailableColors)
            {
                AvailableColors.Add(c);
            }
            index = lsd.saved_index;
            player.SetActive(false);
            UpdatePlayerPos();
            player.SetActive(true);
        }
        else
        {
            //ok either we have no LoadSceneData or its sceneName is different
            //from our last one-- save current info as our new LoadSceneData
            SaveCurrentInfoAsLSD();
        }
        //a quick note on the else block: we could add an UpdateData() function to the
        //LoadSceneData class if so desired (would maybe save some space)
    }
Ejemplo n.º 2
0
 //adds the color specified, switches to it, special case for first color added
 public static void AddColor(ColorIDs.Colors c)
 {
     if (!AvailableColors.Contains(c))
     {
         AvailableColors.Add(c);
         SwitchColor();
     }
     if (AvailableColors.Contains(ColorIDs.Colors.NONE))
     {
         //special case: for the first color added, remove NONE from the available colors
         //list and force the index back down to the first element (which is now our color)
         AvailableColors.Remove(ColorIDs.Colors.NONE);
         index = 0;
     }
 }
Ejemplo n.º 3
0
        private void SetNormalisationChoices()
        {
            var dcs    = new DicomColors();
            var fields = typeof(DicomColors).GetFields();

            foreach (var field in fields)
            {
                AvailableColors.Add((DicomColor)field.GetValue(dcs));
            }

            RelativeNormalisationOptions = new List <RelativeNormalisationOption>()
            {
                RelativeNormalisationOption.Max,
                RelativeNormalisationOption.POI,
            };
            NormalisationTypes = new List <NormalisationType>()
            {
                NormalisationType.Relative,
                NormalisationType.Absolute
            };
            POIs = new ObservableCollection <PointOfInterest>();
        }