Exemplo n.º 1
0
        /// <summary>
        /// Spawn a support animation.
        /// </summary>
        private void SpawnSupAnim()
        {
            for (int index = 0;
                 index < mAnimDesity;
                 ++index)
            {
                // get a random animate from pool
                RuntimeAnimatorController anim = mAnimPoolSupAnim.GetRandomAnim();

                GameObject obj = JCS_Utility.SpawnAnimateObjectDeathEvent(anim, mOrderLayer);

#if (UNITY_EDITOR)
                obj.name = "JCS_2DFullScreenAtkAction";
#endif

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

                AddHitSound(ref obj);
                SetToRandomPos(ref obj);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Spawn a animation for jumping effect.
        /// </summary>
        /// <param name="index"></param>
        private void DoJumpAnimEffect(int index)
        {
            if (mJumpAnim.Length < index)
            {
                return;
            }

            if (mJumpAnim.Length != mJumpAnimOffset.Length)
            {
                return;
            }

            if (mJumpAnim.Length == 0)
            {
                return;
            }

            if (mJumpAnim[index] == null)
            {
                return;
            }

            GameObject gameObject =
                JCS_Utility.SpawnAnimateObjectDeathEvent(
                    mJumpAnim[index],
                    mOrderLayerObject.sortingOrder - 1);

            Vector3 newPos     = Vector3.zero;
            Vector3 tempOffset = mJumpAnimOffset[index];

            // change the position depends on the scale.
            if (this.transform.localScale.x < 0)
            {
                tempOffset.x = -tempOffset.x;
            }

            // assign new position for the effect.
            newPos = this.transform.localPosition + tempOffset;

            // assign to effect's transform.
            gameObject.transform.localPosition = newPos;
            gameObject.transform.localScale    = this.transform.localScale;
        }