コード例 #1
0
        //========================================
        //      Self-Define
        //------------------------------
        //----------------------
        // Public Functions

        /// <summary>
        /// Either use keycode or call it with script!
        /// </summary>
        public void ActiveSkill()
        {
            if (mSkillAnim == null)
            {
                JCS_Debug.LogReminders(
                    "Assigning active skill action without animation is not allowed.");

                return;
            }

            GameObject obj = JCS_Utility.SpawnAnimateObject(mSkillAnim, mOrderLayer);

            if (mSamePosition)
            {
                obj.transform.position = this.transform.position;
            }
            if (mSameRotation)
            {
                obj.transform.rotation = this.transform.rotation;
            }

            // if stay with player, simple set the position to
            // same position and set to child so it will follows
            // the active target!
            if (mStayWithActiveTarget)
            {
                obj.transform.SetParent(this.transform);
            }


            // add anim death event,
            // so when animation ends destroy itself.
            obj.AddComponent <JCS_DestroyAnimEndEvent>();
        }