Beispiel #1
0
        public void Construct(ColorManager colorManager, ISaberModelController modelController, SiraSaberEffectManager siraSaberEffectManager)
        {
            // Woohoo! We received the saber model from Zenject!
            _saberModelController = modelController;
            _saberModelController.Init(transform, nextType);
            _siraSaberEffectManager = siraSaberEffectManager;

            _colorManager = colorManager;

            // Create all the stuff thats supposed to be on the saber
            _saberTypeObject = gameObject.AddComponent <SaberTypeObject>();
            Utilities.ObjectSaberType(ref _saberTypeObject) = nextType;

            // Create and populate the saber object
            _saber = gameObject.AddComponent <Saber>();
            Utilities.SaberObjectType(ref _saber) = _saberTypeObject;
            GameObject top    = new GameObject("Top");
            GameObject bottom = new GameObject("Bottom");

            top.transform.SetParent(transform);
            bottom.transform.SetParent(transform);
            top.transform.position = new Vector3(0f, 0f, 1f);

            Utilities.TopPos(ref _saber)    = top.transform;
            Utilities.BottomPos(ref _saber) = bottom.transform;
            Utilities.HandlePos(ref _saber) = bottom.transform;

            _siraSaberEffectManager.SaberCreated(_saber);
        }
Beispiel #2
0
        internal void Construct(NoteCutter noteCutter, ColorManager colorManager, SaberProvider saberProvider, SiraSaberEffectManager siraSaberEffectManager)
        {
            _noteCutter             = noteCutter;
            _colorManager           = colorManager;
            _saberProvider          = saberProvider;
            _siraSaberEffectManager = siraSaberEffectManager;
            // Create all the stuff thats supposed to be on the saber
            _saberTypeObject = gameObject.AddComponent <SaberTypeObject>();
            Accessors.ObjectSaberType(ref _saberTypeObject) = nextType;

            // Create and populate the saber object
            _saber = gameObject.AddComponent <Saber>();
            Accessors.SaberObjectType(ref _saber) = _saberTypeObject;
            var top    = new GameObject("Top");
            var bottom = new GameObject("Bottom");

            top.transform.SetParent(transform);
            bottom.transform.SetParent(transform);
            top.transform.position = new Vector3(0f, 0f, 1f);

            Accessors.SaberHandleTransform(ref _saber)      = bottom.transform;
            Accessors.SaberBladeTopTransform(ref _saber)    = top.transform;
            Accessors.SaberBladeBottomTransform(ref _saber) = bottom.transform;
            Accessors.SaberBladeTopPosition(ref _saber)     = top.transform.position;
            Accessors.SaberBladeBottomPosition(ref _saber)  = bottom.transform.position;

            _saberProvider.GetModel(smc => smc.Init(transform, _saber));

            _siraSaberEffectManager.SaberCreated(_saber);
        }