Пример #1
0
        private void LoadPlayer()
        {
            // Setup variables
            Animator           = Controller.Animator;
            Animator.Networker = this;
            Animator.Initialize(Controller);

            if (!IsOwner)
            {
            }
            else
            {
                Instance = this;

                foreach (Hitbox hitbox in GetComponentsInChildren <Hitbox>())
                {
                    hitbox.gameObject.layer = 13;
                }

                Enviro.TeamBasedColor.Instance.UpdateColors(nv_Team.Value);
                Settings.GameSettingsManager.Instance.ApplySettings();
            }

            // Disable / Enable
            Controller.isOwner = IsOwner;

            foreach (GameObject go in DisableObjects)
            {
                go.SetActive(IsOwner);
            }
        }
Пример #2
0
        private void Start()
        {
            // Setup variables
            //State.Health = MaxHealth;
            State.Stamina = MaxStamina;

            // Subscribe to callbacks
            OnSelectedWeaponChanged += ChangeWeapon;

            // We do this here to avoid any weird reference stuff
            Animator.ModelRefrences.Initialize();
            // Initialize weapons
            for (int i = 0; i < AllWeapons.Count; i++)
            {
                AllWeapons[i].Initialize(this);
            }
            // Disable all of the other weapon game objects
            for (int i = 0; i < AllWeapons.Count; i++)
            {
                AllWeapons[i].Disable();
            }
            // And enable our weapon
            GetWeaponByID(EquippedWeaponsID[SelectedWeapon]).Enable();
            // Setup movement attributes
            Motor.B_Attr = GetWeaponByID(EquippedWeaponsID[SelectedWeapon]).MovementAttributes;

            // Initialize hitboxes
            foreach (Hitbox hitbox in GetComponentsInChildren <Hitbox>())
            {
                hitbox.Controller = this;
            }

            Input.Initialize();
            Motor.Initialize(Input, this);
            Camera.Initialize(Input, this);
            Animator.Initialize(this);
            HUD.Initialize(this);

            // We do this here so that we don't run into any null reference issue f***s
            // As much as I hate hacky code, I don't hate sleep
            Networker.Spawn(Vector4.zero, Networker.nv_SpawnPoint.Value);
        }