// INITIALIZERS: -------------------------------------------------------------------------- protected override void Awake() { if (!Application.isPlaying) { return; } this.CharacterAwake(); this.initSaveData = new SaveData() { position = transform.position, rotation = transform.rotation, }; if (this.save) { SaveLoadManager.Instance.Initialize( this, (int)SaveLoadManager.Priority.Normal, true ); } HookPlayer hookPlayer = gameObject.GetComponent <HookPlayer>(); if (hookPlayer == null) { gameObject.AddComponent <HookPlayer>(); } if (ON_LOAD_SCENE_DATA != null && ON_LOAD_SCENE_DATA.active) { transform.position = ON_LOAD_SCENE_DATA.position; transform.rotation = ON_LOAD_SCENE_DATA.rotation; ON_LOAD_SCENE_DATA.Consume(); } }
// INITIALIZERS: -------------------------------------------------------------------------- private void Awake() { HookPlayer hookPlayer = gameObject.GetComponent <HookPlayer>(); if (hookPlayer == null) { gameObject.AddComponent <HookPlayer>(); } this.CharacterAwake(); }
// INITIALIZERS: -------------------------------------------------------------------------- protected override void Awake() { if (!Application.isPlaying) { return; } this.CharacterAwake(); this.initSaveData = new SaveData() { position = transform.position, rotation = transform.rotation, }; if (this.save) { SaveLoadManager.Instance.Initialize( this, (int)SaveLoadManager.Priority.Normal, true ); } HookPlayer hookPlayer = gameObject.GetComponent <HookPlayer>(); if (hookPlayer == null) { gameObject.AddComponent <HookPlayer>(); } if (ON_LOAD_SCENE_DATA != null && ON_LOAD_SCENE_DATA.active) { transform.position = ON_LOAD_SCENE_DATA.position; transform.rotation = ON_LOAD_SCENE_DATA.rotation; ON_LOAD_SCENE_DATA.Consume(); } #if UNITY_EDITOR DatabaseGeneral general = DatabaseGeneral.Load(); if (general.forceDisplayInEditor) { this.forceDisplayTouchstick = general.forceDisplayInEditor; } #endif }
/*private void OnDash() * { * * }*/ private void Start() { if (!initialized) { initialized = true; if (networkCulling && photonView.IsMine && PhotonNetwork.InRoom) { if (CullArea.NumberOfSubdivisions == 0) { this.photonView.Group = CullArea.FIRST_GROUP_ID; PhotonNetwork.SetInterestGroups(CullArea.FIRST_GROUP_ID, true); } else { // This is used to continuously update the active group. //this.photonView.ObservedComponents.Add(this); } } if (character && PhotonNetwork.InRoom && gameObject) { character.onJump.AddListener(OnJump); //character.onDash.AddListener(OnDash); if (character is PlayerCharacter) { isPlayer = character is PlayerCharacter; if (!photonView.IsMine) { //locomotion.faceDirection = CharacterLocomotion.FACE_DIRECTION.None; //locomotion.SetIsControllable(false); HookPlayer hookPlayer = gameObject.GetComponent <HookPlayer>(); Destroy(hookPlayer); /// Workaround to reset the HookPlayer reference to the local player. if (Player) { hookPlayer = Player.GetComponent <HookPlayer>(); Destroy(hookPlayer); Player.gameObject.AddComponent <HookPlayer>(); } } else { Player = this; } photonView.Owner.TagObject = gameObject; } } if (PhotonNetwork.InRoom && !photonView.IsMine && character is PlayerCharacter) { Locomotion.SetIsControllable(false); if (Locomotion.faceDirection != CharacterLocomotion.FACE_DIRECTION.Target) { Locomotion.faceDirection = CharacterLocomotion.FACE_DIRECTION.Target; Locomotion.faceDirectionTarget.target = GameCreator.Core.TargetPosition.Target.Invoker; } //Locomotion.overrideFaceDirection = CharacterLocomotion.OVERRIDE_FACE_DIRECTION.Target; //Locomotion.overrideFaceDirectionTarget.target = GameCreator.Core.TargetPosition.Target.Position; } /*if (syncAttachments) * { * while (character.GetCharacterAnimator().GetCharacterAttachments() == null) * { * yield return null; * } * * characterAttachments = character.GetCharacterAnimator().GetCharacterAttachments(); * if (photonView.IsMine) * { * characterAttachments.onAttach += (OnAttach); * characterAttachments.onDetach += (OnDettach); * } * }*/ } }