Beispiel #1
0
    private static void CheatSetPawnDoodle(string imagePath)
    {
        if (!GamePresentationCache.Instance.Ready)
        {
            return;
        }

        var    simWorld  = GamePresentationCache.Instance.SimWorld;
        Entity localPawn = GamePresentationCache.Instance.LocalPawn;

        // find current pawn's doodle asset
        Guid currentDoodleGuid = Guid.Empty;

        if (simWorld.TryGetComponent(localPawn, out DoodleId doodleId))
        {
            currentDoodleGuid = doodleId.Guid;
        }

        PlayerDoodleAsset playerDoodleAsset = PlayerAssetManager.Instance.GetAsset <PlayerDoodleAsset>(currentDoodleGuid);

        // If pawn's doodle doesn't exist, create a new one + submit a sim input to assign it
        if (playerDoodleAsset == null)
        {
            playerDoodleAsset = PlayerAssetManager.Instance.CreateAsset <PlayerDoodleAsset>();

            PresentationHelpers.SubmitInput(new SimPlayerInputSetPawnDoodle(playerDoodleAsset.Guid, true));
        }

        // Load image into doodle texture
        playerDoodleAsset.Load(File.ReadAllBytes(imagePath));

        // publish changes
        PlayerAssetManager.Instance.PublishAssetChanges(playerDoodleAsset.Guid);
    }
Beispiel #2
0
    public override void OnGameStart()
    {
        base.OnGameStart();

        UIStateMachine.Instance.TransitionTo(UIStateType.Drawing);

        _readyButton.onClick.AddListener(ApplyCharacterSettings);

        _doodleAsset = PlayerAssetManager.Instance.CreateAsset <PlayerDoodleAsset>();
    }