// Use this for initialization
        protected override void Start()
        {
            _animator = GetComponent <Animator>();

            if (GameManager.SaveLoaded)
            {
                MyPlayerManager.Load(MyGameManager.Save);
                MyGameManager.Save     = null;
                GameManager.SaveLoaded = false;
            }

            if (MyPlayerManager.Initialized == false)
            {
                MyPlayerManager.InitPlayer(DisplayName, MaxHealth);
                MyPlayerManager.Initialized = true;
            }

            CurHealth   = MyPlayerManager.CurrentHealth;
            _hudManager = GameObject.FindGameObjectWithTag("HudManager");

            _hudManager.GetComponent <LevelDisplay>().UpdateLevel(MyPlayerManager.Level);
            UpdateHealthDisplay();

            base.Start();
        }
Beispiel #2
0
 private void Awake()
 {
     Instance = this;
     players  = GetComponentsInChildren <MyPlayer>();
 }