コード例 #1
0
ファイル: GalTouchSystem.cs プロジェクト: slb1988/agame
        private ReactionPattern GetPatternByBodyPartTypeAndHeartLevel(BodyPartType bodyPartType, int heartLevel, out int index, out bool advance)
        {
            ReactionPattern reactionPattern = null;

            index   = -1;
            advance = false;
            int num   = 0;
            int count = this._touchPatternList.Count;

            while (num < count)
            {
                TouchPatternItem item = this._touchPatternList[num];
                if ((item.bodyPartType == bodyPartType) && (item.heartLevel == heartLevel))
                {
                    reactionPattern = item.reactionPattern;
                    index           = num;
                }
                if (reactionPattern != null)
                {
                    if (item.advanceTime > 0)
                    {
                        bool flag = true;
                        int  num3 = 0;
                        int  num4 = item.advanceTime - 1;
                        while (num3 < num4)
                        {
                            if ((num3 >= this._itemIndexRecord.Count) || (this._itemIndexRecord[(this._itemIndexRecord.Count - num3) - 1] != num))
                            {
                                flag = false;
                                break;
                            }
                            num3++;
                        }
                        if (flag)
                        {
                            reactionPattern = item.advanceReactionPattern;
                            advance         = true;
                        }
                    }
                    return(reactionPattern);
                }
                num++;
            }
            return(reactionPattern);
        }
コード例 #2
0
ファイル: GalTouchSystem.cs プロジェクト: slb1988/agame
 private bool ActReactionPattern(ReactionPattern pattern)
 {
     if (!this.idle)
     {
         return(false);
     }
     if (!string.IsNullOrEmpty(pattern.bodyStateName) && (this._animator != null))
     {
         this._animator.CrossFadeInFixedTime(pattern.bodyStateName, 0.3f, 0);
     }
     if (!string.IsNullOrEmpty(pattern.faceStateName) && (this._faceAnimation != null))
     {
         this._faceAnimation.PlayFaceAnimation(pattern.faceStateName, FaceAnimationPlayMode.Normal);
     }
     if (!string.IsNullOrEmpty(pattern.faceEffectName) && (this._faceEffect != null))
     {
         this._faceEffect.ShowEffect(pattern.faceEffectName);
     }
     return(true);
 }
コード例 #3
0
ファイル: GalTouchSystem.cs プロジェクト: slb1988/agame
        public bool BodyPartTouched(BodyPartType type)
        {
            if (this._touchPatternList == null)
            {
                return(false);
            }
            if (!this.enable)
            {
                return(false);
            }
            int             index   = -1;
            bool            advance = false;
            ReactionPattern pattern = this.GetPatternByBodyPartTypeAndHeartLevel(type, this._heartLevel, out index, out advance);

            if (pattern == null)
            {
                return(false);
            }
            bool flag2 = this.ActReactionPattern(pattern);

            if (flag2)
            {
                if (advance)
                {
                    this._itemIndexRecord.Clear();
                }
                else
                {
                    if (this._itemIndexRecord.Count >= 20)
                    {
                        this._itemIndexRecord.RemoveAt(0);
                    }
                    this._itemIndexRecord.Add(index);
                }
                this._idle = false;
                if (this.IdleChanged != null)
                {
                    this.IdleChanged(this._idle);
                }
                if (this.TouchPatternTriggered == null)
                {
                    return(flag2);
                }
                int num2 = 0;
                if (type == BodyPartType.Face)
                {
                    num2 = 1;
                }
                else if (type == BodyPartType.Head)
                {
                    num2 = 2;
                }
                else if (type == BodyPartType.Chest)
                {
                    num2 = !advance ? 3 : 4;
                }
                else if (type == BodyPartType.Private)
                {
                    num2 = !advance ? 5 : 6;
                }
                else if (type == BodyPartType.Arm)
                {
                    num2 = 7;
                }
                else if (type == BodyPartType.Stomach)
                {
                    num2 = 8;
                }
                else if (type == BodyPartType.Leg)
                {
                    num2 = 9;
                }
                if (num2 != 0)
                {
                    this.TouchPatternTriggered(num2);
                }
            }
            return(flag2);
        }