protected void Awake()
        {
            positionToShow = new List <Position>();

            if (instance == null)
            {
                instance = this;
            }
            else if (instance != this)
            {
                Destroy(gameObject);
            }

            // Sets this to not be destroyed when reloading scene
            DontDestroyOnLoad(gameObject);

            foreach (Position pos in instances)
            {
                if (pos != null)
                {
                    positionToShow.Add(pos);
                }
            }

            positionToShow.Sort(ComparePositions);
        }
Exemplo n.º 2
0
        protected override void Awake()
        {
            position = GetComponent <Position>();
            if (position == null)
            {
                position = gameObject.AddComponent <Position>();
            }

            base.Awake();

            PositionRegistry.RegisterInstance(position);
        }
Exemplo n.º 3
0
 protected void Awake()
 {
     PositionRegistry.RegisterInstance(this);
 }