public void Init(
            CharacterAsset asset,
            RenderTexture renderTexture,
            float horizontalOffset
            )
        {
            _characterAsset       = asset;
            _renderTexture        = renderTexture;
            _camera.targetTexture = _renderTexture;

            transform.localPosition = Vector3.right * horizontalOffset;

            _character = asset.Create(
                transform.position,
                _anchor,
                Quaternion.identity);
            _character.Transform.rotation =
                Quaternion.LookRotation(
                    Vector3.forward,
                    Vector3.up);
            _character.FSM_SetState(
                World.Objects
                .ObjectState
                .CharacterSelect);

            UpdateCamera();
        }
Exemple #2
0
        public void Add(
            PlayerSession player,
            CharacterAsset characterResource)
        {
            Platform platform = _platformTemplate.Create(
                _platformsParent.transform.position + Vector3.right * _platforms.Count * PlatformOffset,
                _platformsParent.transform,
                player);

            platform.OnPlatformFinishedHandler += OnPlatformFinished;
            _platforms.Add(platform);
            _timer.OnTimeLimitHandler += platform.OnTransitionToTimeOut;

            Character character =
                characterResource.Create(
                    platform._characterAnchor.transform.position,
                    platform._characterAnchor.transform);

            _characters.Add(character);
            character.transform.rotation = platform._visual.Parent.transform.rotation;
            platform.Character           = character;

            character.ColorId = player.ServerId;
            character.Color   = player.Color;
        }