示例#1
0
 private void OnEntityBoundsCheckerStatusChanged(DCL.Models.IDCLEntity entity, bool isInsideBoundaries)
 {
     if (!isInsideBoundaries)
     {
         if (!entitiesOutOfBounds.Contains(entity.entityId))
         {
             entitiesOutOfBounds.Add(entity.entityId);
             eventBuilderOutOfBounds.Play();
         }
     }
     else
     {
         if (entitiesOutOfBounds.Contains(entity.entityId))
         {
             entitiesOutOfBounds.Remove(entity.entityId);
         }
     }
 }
示例#2
0
    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
        };
    }
示例#3
0
    private void OnEntityBoundsCheckerStatusChanged(DCL.Models.IDCLEntity entity, bool isInsideBoundaries)
    {
        if (state == BIWModeController.EditModeState.Inactive)
        {
            return;
        }

        if (!isInsideBoundaries)
        {
            if (!entitiesOutOfBounds.Contains(entity.entityId))
            {
                entitiesOutOfBounds.Add(entity.entityId);
                eventBuilderOutOfBounds.Play();
            }
        }
        else
        {
            if (entitiesOutOfBounds.Contains(entity.entityId))
            {
                entitiesOutOfBounds.Remove(entity.entityId);
            }
        }
    }