コード例 #1
0
        public override void DoAction(PEActionParam para = null)
        {
            PEActionParamVQSN paramVQSN = para as PEActionParamVQSN;

            motionMgr.SetMaskState(PEActionMask.Sit, true);
            m_EndAction = false;

            if (null != trans)
            {
                trans.position = paramVQSN.vec;
                trans.rotation = paramVQSN.q;
            }

            if (null != anim)
            {
                m_AnimName = paramVQSN.str;
                anim.SetBool(m_AnimName, true);
                anim.ResetTrigger("ResetFullBody");
            }
            m_BuffID = paramVQSN.n;
            if (0 != m_BuffID && null != motionMgr.Entity.skEntity)
            {
                PESkEntity.MountBuff(motionMgr.Entity.skEntity, m_BuffID, new System.Collections.Generic.List <int>(), new System.Collections.Generic.List <float>());
            }
            motionMgr.FreezePhyState(GetType(), true);
            if (null != motionMgr.Entity.IKCmpt)
            {
                motionMgr.Entity.IKCmpt.ikEnable = false;
            }
        }
コード例 #2
0
        private static AttribType GetProtoMaxAttr(int npcId, PESkEntity entity, AttribType[] ChangeAbleAttr)
        {
//			float maxP = 0;
            //主线NPC固定
            AttribType FindAttr = ChangeAbleAttr[0];

//			NpcProtoDb.Item Proto = NpcProtoDb.Get(npcId);
//			Pathea.PESkEntity.Attr[] attr = Proto.dbAttr.ToAliveAttr();
//			if(attr == null)
//				return AttribType.Max;
//
//			for(int i=0;i<attr.Length;i++)
//			{
//
//			}
//
//			for(int i=0;i<ChangeAbleAttr.Length;i++)
//			{
//				float currentAttrP = entity.GetAttribute(ChangeAbleAttr[i])/Proto.dbAttr.attributeArray[(int)ChangeAbleAttr[i]];
//				if(currentAttrP > maxP)
//				{
//					FindAttr = ChangeAbleAttr[i];
//					maxP = currentAttrP;
//				}
//			}
            return(FindAttr);
        }
コード例 #3
0
 public void CheckAttrib(PESkEntity entity, AttribType type, float value)
 {
     if (m_AttribPairs[(int)type] != null)
     {
         m_AttribPairs [(int)type].CheckAttrib(entity, type, value);
     }
 }
コード例 #4
0
    public static void PlotPlay(List <CameraInfo> clipsID)
    {
        if (isPlaying == false)
        {
            plotClips   = clipsID;
            plotClipNum = 0;
            CutsceneClip first = Cutscene.PlayClip(plotClips[plotClipNum].cameraId);
            TalkId_cut[plotClips[plotClipNum].talkId] = first;                  //  TalkId_cut.Add(plotClips[plotClipNum].talkId, first);
            first.onArriveAtEnding.AddListener(PlotNextPlay);
            isPlaying = true;

            if (Pathea.PeCreature.Instance.mainPlayer != null)
            {
                Pathea.PeCreature.Instance.mainPlayer.motionMgr.DoAction(Pathea.PEActionType.Cutscene);
                //Pathea.PeEntityExt.PeEntityExt.SetInvincible(Pathea.PeCreature.Instance.mainPlayer, true);
                Pathea.PESkEntity skentity = Pathea.PeCreature.Instance.mainPlayer.peSkEntity;
                skentity.SetAttribute(Pathea.AttribType.CampID, 28);
                skentity.SetAttribute(Pathea.AttribType.DamageID, 28);
            }
        }
        else
        {
            plotClips.AddRange(clipsID);
        }
    }
コード例 #5
0
        public static AttribType  GetProtoMaxAttribute(int npcId, PESkEntity peSkentity)
        {
            AttPlusNPCData.Item npc = AttPlusNPCData.Get(npcId);
            if (npc == null || npc.AttPlus == null)
            {
                return(AttribType.Max);
            }

            return(GetProtoMaxAttr(npcId, peSkentity, npc.AttPlus.GetType().ToArray()));
        }
コード例 #6
0
 public static void ApplySkCameraEffect(int id, Pathea.PESkEntity skEntity)
 {
     Pathea.MainPlayerCmpt mainPlayerCmpt = skEntity.GetComponent <Pathea.MainPlayerCmpt>();
     if (mainPlayerCmpt != null)
     {
         if (id == 1)
         {
             PlayAttackShake();
         }
     }
 }
コード例 #7
0
        public static AttribType GetRandMaxAttribute(int npcId, PESkEntity peSkentity)
        {
            AttPlusNPCData.Item npc = AttPlusNPCData.Get(npcId);
            if (npc == null || npc.AttPlus == null)
            {
                Debug.Log("Don't have NPcdata" + npcId);
                return(AttribType.Max);
            }

            return(GetRandMaxAttr(npcId, peSkentity, npc.AttPlus.GetType().ToArray()));
        }
コード例 #8
0
 public void CheckAttrib(PESkEntity entity, AttribType type, float value)
 {
     if (type == m_Current)
     {
         if (value < 0 || value > entity.GetAttribute(m_Max))
         {
             entity.SetAttribute(m_Current, Mathf.Clamp(value, 0, entity.GetAttribute(m_Max)));
         }
     }
     else if (type == m_Max)
     {
         float currentValue = entity.GetAttribute(m_Current);
         if (currentValue > value)
         {
             entity.SetAttribute(m_Current, value);
         }
     }
 }
コード例 #9
0
        public override void Start()
        {
            base.Start();
            mPeTrans   = Entity.peTrans;
            mSkEntity  = Entity.GetComponent <PESkEntity>();
            mMotionMgr = Entity.GetCmpt <MotionMgrCmpt>();

            if (mRailRouteId != Railway.Manager.InvalId)
            {
                if (null != Railway.Manager.Instance.GetRoute(mRailRouteId))
                {
                    DoGetOn(mRailRouteId, true);
                }
                else
                {
                    mRailRouteId = Railway.Manager.InvalId;
                }
            }
        }
コード例 #10
0
        void OnColliderEnter(Collider self, Collider other)
        {
            if (other.gameObject.layer != Pathea.Layer.Damage &&
                other.gameObject.layer != Pathea.Layer.GIEProductLayer)
            {
                return;
            }

            if (!other.transform.IsChildOf(transform) && self.transform.IsChildOf(transform))
            {
                SkEntity entity = other.transform.GetComponentInParent <SkEntity>();
                if (entity != null)
                {
                    PESkEntity skEntity = entity as PESkEntity;
                    if (skEntity == null || !skEntity.isDead)
                    {
//                        CollisionCheck(self, other);
                        //AddCollisionSkEntity(self, other);
                    }
                }
            }
        }
コード例 #11
0
        public void DispatchHPChangeEvent(SkEntity caster, float hpChange)
        {
            if (null != onHpChange)
            {
                onHpChange(caster, hpChange);
                PeEventGlobal.Instance.HPChangeEvent.Invoke(this, caster, hpChange);
            }

            if (hpChange < -PETools.PEMath.Epsilon)
            {
                if (onHpReduce != null)
                {
                    onHpReduce(caster, Mathf.Abs(hpChange));
                }
                if (entityAttackEvent != null)
                {
                    entityAttackEvent(this, caster, Mathf.Abs(hpChange));
                }

                PESkEntity _caster = PETools.PEUtil.GetCaster(caster) as PESkEntity;
                if (_caster != null && _caster.attackEvent != null)
                {
                    _caster.attackEvent(this, Mathf.Abs(hpChange));
                }

                PeEventGlobal.Instance.HPReduceEvent.Invoke(this, caster, Mathf.Abs(hpChange));
            }

            if (hpChange > PETools.PEMath.Epsilon)
            {
                if (onHpRecover != null)
                {
                    onHpRecover(caster, Mathf.Abs(hpChange));
                }

                PeEventGlobal.Instance.HPRecoverEvent.Invoke(this, caster, Mathf.Abs(hpChange));
            }
        }
コード例 #12
0
        private static AttribType GetRandMaxAttr(int npcId, PESkEntity entity, AttribType[] ChangeAbleAttr)
        {
            float      maxP     = 0;
            AttribType FindAttr = ChangeAbleAttr[0];

            RandomNpcDb.Item      rand      = RandomNpcDb.Get(npcId);
            RandomNpcDb.RandomInt randomint = new RandomNpcDb.RandomInt();
            for (int i = 0; i < ChangeAbleAttr.Length; i++)
            {
                if (!rand.TryGetAttrRandom(ChangeAbleAttr[i], out randomint) || randomint.m_Max == 0)
                {
                    continue;
                }

                float currentAttrP = (entity.GetAttribute(ChangeAbleAttr[i], false) - randomint.m_Min) / (randomint.m_Max - randomint.m_Min);
                if (currentAttrP > maxP)
                {
                    FindAttr = ChangeAbleAttr[i];
                    maxP     = currentAttrP;
                }
            }
            return(FindAttr);
        }
コード例 #13
0
 private static void PlotNextPlay()
 {
     plotClipNum++;
     if (plotClipNum < plotClips.Count)
     {
         CutsceneClip notFirst = Cutscene.PlayClip(plotClips[plotClipNum].cameraId);
         TalkId_cut[plotClips[plotClipNum].talkId] = notFirst;               //TalkId_cut.Add(plotClips[plotClipNum].talkId, notFirst);
         notFirst.onArriveAtEnding.AddListener(PlotNextPlay);
     }
     else
     {
         if (Pathea.PeCreature.Instance.mainPlayer != null)
         {
             Pathea.PeCreature.Instance.mainPlayer.motionMgr.EndAction(Pathea.PEActionType.Cutscene);
             //Pathea.PeEntityExt.PeEntityExt.SetInvincible(Pathea.PeCreature.Instance.mainPlayer, false);
             Pathea.PESkEntity skentity = Pathea.PeCreature.Instance.mainPlayer.peSkEntity;
             skentity.SetAttribute(Pathea.AttribType.CampID, 1);
             skentity.SetAttribute(Pathea.AttribType.DamageID, 1);
         }
         plotClipNum = 0;
         TalkId_cut.Clear();
         isPlaying = false;
     }
 }
コード例 #14
0
        public static int CheckAttrbCase(PESkEntity peskentity)
        {
            RandomAttrChoce attr     = new RandomAttrChoce();
            AttribType      type     = attr.RandType();
            float           curvalue = peskentity.GetAttribute(type);

            switch (type)
            {
            case AttribType.Hunger:
            {
                float maxHunger = peskentity.GetAttribute(AttribType.HungerMax);

                if (curvalue <= maxHunger * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_medium)._value &&
                    curvalue > maxHunger * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_medium).Scenario.RandCase());
                }
                else if (curvalue <= maxHunger * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_hunger_low).Scenario.RandCase());
                }
                else
                {
                    return(-1);
                }
            }

            //	break;
            case AttribType.Hp:
            {
                float maxHp = peskentity.GetAttribute(AttribType.HpMax);
                if (curvalue <= maxHp * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_medium)._value &&
                    curvalue > maxHp * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_medium).Scenario.RandCase());
                }
                else if (curvalue <= maxHp * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_health_low).Scenario.RandCase());
                }
                else
                {
                    return(-1);
                }
            }

            //	break;
            case AttribType.Comfort:
            {
                float maxcomfort = peskentity.GetAttribute(AttribType.ComfortMax);
                if (curvalue <= maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_common)._value &&
                    curvalue > maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_medium)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_common).Scenario.RandCase());
                }
                else if (curvalue <= maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_medium)._value &&
                         curvalue > maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_low)._value
                         )
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_medium).Scenario.RandCase());
                }
                else if (curvalue <= maxcomfort * NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_low)._value)
                {
                    return(NpcRandomTalkDb.Get((int)ENpcTalkType.Follower_comfort_low).Scenario.RandCase());
                }
                else
                {
                    return(-1);
                }
            }
            //	break;

            default:
                break;
            }
            return(-1);
        }