void Awake() { if (i != null) { Destroy(gameObject); return; } i = this; originalGravity = gravity; SuscribeToInput(); CommonScriptableObjects.playerUnityPosition.Set(Vector3.zero); CommonScriptableObjects.playerWorldPosition.Set(Vector3.zero); CommonScriptableObjects.playerCoords.Set(Vector2Int.zero); CommonScriptableObjects.playerUnityEulerAngles.Set(Vector3.zero); characterPosition = new DCLCharacterPosition(); characterController = GetComponent <CharacterController>(); collider = GetComponent <Collider>(); characterPosition.OnPrecisionAdjust += OnPrecisionAdjust; SceneController.OnDebugModeSet += () => supportsMovingPlatforms = true; lastPosition = transform.position; transform.parent = null; CommonScriptableObjects.rendererState.OnChange += OnRenderingStateChanged; OnRenderingStateChanged(CommonScriptableObjects.rendererState.Get(), false); }
public BlockerInstanceHandler(DCLCharacterPosition characterPosition, IBlockerAnimationHandler animationHandler) { this.characterPosition = characterPosition; this.animationHandler = animationHandler; RenderProfileManifest.i.OnChangeProfile += OnChangeProfile; OnChangeProfile(RenderProfileManifest.i.currentProfile); }
void OnPrecisionAdjust(DCLCharacterPosition charPos) { Vector3 oldPos = this.transform.position; this.transform.position = charPos.unityPosition; if (CinemachineCore.Instance.BrainCount > 0) { CinemachineCore.Instance.GetActiveBrain(0).ActiveVirtualCamera?.OnTargetObjectWarped(transform, transform.position - oldPos); } }
public WorldBlockersController(ISceneHandler sceneHandler, IBlockerHandler blockerHandler, DCLCharacterPosition characterPosition) { this.blockerHandler = blockerHandler; this.sceneHandler = sceneHandler; this.characterPosition = characterPosition; blockersParent = new GameObject("WorldBlockers").transform; blockersParent.position = Vector3.zero; characterPosition.OnPrecisionAdjust += OnWorldReposition; }
private void SetPositionDirty(DCLCharacterPosition character) { var currentX = (int)Math.Floor(character.worldPosition.x / ParcelSettings.PARCEL_SIZE); var currentY = (int)Math.Floor(character.worldPosition.z / ParcelSettings.PARCEL_SIZE); positionDirty = currentX != currentGridSceneCoordinate.x || currentY != currentGridSceneCoordinate.y; if (positionDirty) { sceneSortDirty = true; currentGridSceneCoordinate.x = currentX; currentGridSceneCoordinate.y = currentY; } }
void OnCharacterMoved(DCLCharacterPosition newCharacterPosition) { if (canvas != null) { currentCharacterPosition = newCharacterPosition; UpdateCanvasVisibility(); if (VERBOSE) { Debug.Log($"set screenspace = {currentCharacterPosition}"); } } }
public BlockerHandler(DCLCharacterPosition characterPosition) { this.characterPosition = characterPosition; if (blockerPrefab == null) { blockerPrefab = Resources.Load <GameObject>(PARCEL_BLOCKER_PREFAB); } // We need to manually create the Pool for empty game objects if it doesn't exist if (!PoolManager.i.ContainsPool(PARCEL_BLOCKER_POOL_NAME)) { GameObject go = Object.Instantiate(blockerPrefab); Pool pool = PoolManager.i.AddPool(PARCEL_BLOCKER_POOL_NAME, go); pool.persistent = true; pool.ForcePrewarm(); } }
void Awake() { if (i != null) { Destroy(gameObject); return; } i = this; originalGravity = gravity; SubscribeToInput(); CommonScriptableObjects.playerUnityPosition.Set(Vector3.zero); CommonScriptableObjects.playerWorldPosition.Set(Vector3.zero); CommonScriptableObjects.playerCoords.Set(Vector2Int.zero); CommonScriptableObjects.playerUnityEulerAngles.Set(Vector3.zero); characterPosition = new DCLCharacterPosition(); characterController = GetComponent <CharacterController>(); freeMovementController = GetComponent <FreeMovementController>(); collider = GetComponent <Collider>(); CommonScriptableObjects.worldOffset.OnChange += OnWorldReposition; Environment.i.platform.debugController.OnDebugModeSet += () => supportsMovingPlatforms = true; lastPosition = transform.position; transform.parent = null; CommonScriptableObjects.rendererState.OnChange += OnRenderingStateChanged; OnRenderingStateChanged(CommonScriptableObjects.rendererState.Get(), false); if (avatarGameObject == null || firstPersonCameraGameObject == null) { throw new System.Exception("Both the avatar and first person camera game objects must be set."); } avatarReference = new DCL.Models.DecentralandEntity { gameObject = avatarGameObject }; firstPersonCameraReference = new DCL.Models.DecentralandEntity { gameObject = firstPersonCameraGameObject }; }
private void SetPositionDirty(DCLCharacterPosition character) { var currentX = (int)Math.Floor(character.worldPosition.x / ParcelSettings.PARCEL_SIZE); var currentY = (int)Math.Floor(character.worldPosition.z / ParcelSettings.PARCEL_SIZE); positionDirty = currentX != currentGridSceneCoordinate.x || currentY != currentGridSceneCoordinate.y; if (positionDirty) { sceneSortDirty = true; currentGridSceneCoordinate.x = currentX; currentGridSceneCoordinate.y = currentY; // Since the first position for the character is not sent from Kernel until just-before calling // the rendering activation from Kernel, we need to sort the scenes to get the current scene id // to lock the rendering accordingly... if (!CommonScriptableObjects.rendererState.Get()) { SortScenesByDistance(); } } }
void OnPrecisionAdjust(DCLCharacterPosition position) { avatarTransform.position = position.WorldToUnityPosition(currentWorldPosition); }
private void PrecisionAdjust(DCLCharacterPosition obj) { avatarUserInfo.worldPosition = entity.gameObject.transform.position; MinimapMetadataController.i?.UpdateMinimapUserInformation(avatarUserInfo); }
void OnWorldReposition(DCLCharacterPosition charPos) { var newPosition = charPos.WorldToUnityPosition(Vector3.zero); // Blockers parent original position blockersParent.position = newPosition; }
public static WorldBlockersController CreateWithDefaultDependencies(ISceneHandler sceneHandler, DCLCharacterPosition characterPosition) { var blockerAnimationHandler = new BlockerAnimationHandler(); var blockerInstanceHandler = new BlockerInstanceHandler( characterPosition, blockerAnimationHandler ); var worldBlockersController = new WorldBlockersController( sceneHandler, blockerInstanceHandler, characterPosition); return(worldBlockersController); }
void OnCharacterMoved(DCLCharacterPosition position) { ChangeOrientation(); }
void OnPrecisionAdjust(DCLCharacterPosition position) { gameObject.transform.position = position.WorldToUnityPosition(Utils.GridToWorldPosition(sceneData.basePosition.x, sceneData.basePosition.y)); }
private void OnTeleport(DCLCharacterPosition characterPosition) { DCLCharacterController.OnPositionSet -= OnTeleport; isWelcomeHudVisible = false; }
private void OnTeleport(DCLCharacterPosition characterPosition) { characterTeleported = true; TutorialController.i.SkipToNextStep(); }
private void OnCharacterMove(DCLCharacterPosition position) { characterMoved = true; }
public bool IsInsideSceneBoundaries(DCLCharacterPosition charPosition) { return(IsInsideSceneBoundaries(Utils.WorldToGridPosition(charPosition.worldPosition))); }
void ExitAfterCharacterTeleport(DCLCharacterPosition position) { ExitEditMode(); }