/// <summary>
        /// Load model.
        /// </summary>
        private void Start()
        {
            var model = this.FindCubismModel();

            // Get components.
            _motionController     = model.GetComponent <CubismMotionController>();
            _expressionController = model.GetComponent <CubismExpressionController>();
            _raycaster            = model.GetComponent <CubismRaycaster>();


            // Set behavior at the end of animation.
            _motionController.AnimationEndHandler = AnimationEnded;


            // Get up to 4 results of collision detection.
            _raycastResults = new CubismRaycastHit[4];


            // Cache the drawable in which the component is set.
            {
                _hasHitDrawables = new List <HitDrawableInfomation>();

                var hitAreas  = Enum.GetValues(typeof(HitArea));
                var drawables = model.Drawables;


                for (var i = 0; i < hitAreas.Length; i++)
                {
                    for (var j = 0; j < drawables.Length; j++)
                    {
                        var cubismHitDrawable = drawables[j].GetComponent <CubismHitDrawable>();

                        if (cubismHitDrawable)
                        {
                            if (cubismHitDrawable.Name == hitAreas.GetValue(i).ToString())
                            {
                                var hitDrawable = new HitDrawableInfomation();
                                hitDrawable.drawable = drawables[j];
                                hitDrawable.hitArea  = (HitArea)i;

                                _hasHitDrawables.Add(hitDrawable);
                                break;
                            }
                        }
                    }
                }
            }
        }
 void Start()
 {
     anim      = GetComponent <Animator>();
     raycaster = GetComponent <CubismRaycaster>();
 }
Exemple #3
0
        //----- property -----

        //----- method -----

        public void SetParams(CubismRaycaster raycaster)
        {
            this.raycaster = raycaster;
        }
 private void Awake()
 {
     cameraManager   = Engine.GetService <ICameraManager>();
     cubismRaycaster = GetComponent <CubismRaycaster>();
 }