コード例 #1
0
        /// <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;
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
 void Start()
 {
     anim      = GetComponent <Animator>();
     raycaster = GetComponent <CubismRaycaster>();
 }
コード例 #3
0
        //----- property -----

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

        public void SetParams(CubismRaycaster raycaster)
        {
            this.raycaster = raycaster;
        }
コード例 #4
0
 private void Awake()
 {
     cameraManager   = Engine.GetService <ICameraManager>();
     cubismRaycaster = GetComponent <CubismRaycaster>();
 }