public override bool Parse() { if (mInfo.Name != "STMT") { Debug.LogError("error node:" + mInfo); return(false); } VarRef npcId = PeType.GetNpcId(mInfo, mTrigger); int id = (int)npcId.Value; Pathea.PeEntity entity = Pathea.EntityMgr.Instance.Get(id); if (null == entity) { Debug.LogError("can't find entity:" + id); return(false); } mMove = entity.GetCmpt <Pathea.Motion_Move>(); if (null == mMove) { Debug.LogError("can't find move cmpt:"); return(false); } return(true); }
public override bool Parse() { if (false == base.Parse()) { return(false); } mMosterId = PeType.GetMonsterId(mInfo, mTrigger); return(true); }
public override bool Parse() { if (false == base.Parse()) { return(false); } mVarRef = PeType.GetUIId(mInfo, mTrigger); return(true); }
public override bool Parse() { mPlayerId = PeType.GetPlayerId(mInfo, mTrigger); mItemId = PeType.GetItemId(mInfo, mTrigger); mItemCount = PatheaScript.Util.GetVarRefOrValue(mInfo, "count", VarValue.EType.Int, mTrigger); mCompare = mFactory.GetCompare(mInfo, "compare"); return(true); }
public override bool Parse() { mCompare = mFactory.GetCompare(mInfo, "compare"); mCount = PatheaScript.Util.GetVarRefOrValue(mInfo, "count", VarValue.EType.Int, mTrigger); mMonsterId = PeType.GetMonsterId(mInfo, mTrigger); PeEvent.Globle.kill.Subscribe(Handler); return(true); }
protected override bool Exec() { VarRef playerId = PeType.GetPlayerId(mInfo, mTrigger); VarRef itemIdVarRef = PeType.GetItemId(mInfo, mTrigger); VarRef count = PatheaScript.Util.GetVarRefOrValue(mInfo, "count", VarValue.EType.Int, mTrigger); Functor modify = mFactory.GetFunctor(mInfo, "modify"); List <Pathea.PeEntity> playerList = PeType.GetPlayer((int)playerId.Value); int itemId = (int)itemIdVarRef.Value; foreach (Pathea.PeEntity player in playerList) { Pathea.PlayerPackageCmpt pkg = player.GetCmpt <Pathea.PlayerPackageCmpt>(); ItemAsset.ItemPackage accessor = pkg.package._playerPak; int itemCount = accessor.GetCount(itemId); modify.Set(new Variable(itemCount), count.Var); modify.Do(); int newItemCount = (int)(modify.Target.Value); if (newItemCount == itemCount) { continue; } else if (newItemCount > itemCount) { int dd = newItemCount - itemCount; if (!accessor.Add(itemId, dd)) { Debug.LogError("Add item:" + itemId + " to player:" + player + " failed."); } else { Debug.Log("Add item:" + itemId + " count:" + dd + " to player:" + player + " succeed."); } } else { int dd = itemCount - newItemCount; accessor.Destroy(itemId, dd); Debug.Log("remove item:" + itemId + " count:" + dd + "from player:" + player + " succeed."); } } return(true); }
public override bool Do() { List <Pathea.PeEntity> list = PeType.GetPlayer((int)mPlayerId.Value); bool ret = true; foreach (Pathea.PeEntity p in list) { Pathea.PlayerPackageCmpt pkg = p.GetCmpt <Pathea.PlayerPackageCmpt>(); int hasCount = pkg.package.GetCount((int)mItemId.Value); if (false == mCompare.Do(hasCount, mItemCount.Value)) { ret = false; } } return(ret); }
protected override bool Exec() { VarRef playerId = PeType.GetPlayerId(mInfo, mTrigger); VarRef varRef = PatheaScript.Util.GetVarRefOrValue(mInfo, "pos", VarValue.EType.Vector3, mTrigger); //TODO:need parse func List <Pathea.PeEntity> playerList = PeType.GetPlayer((int)playerId.Value); foreach (Pathea.PeEntity player in playerList) { Pathea.PeTrans v = player.GetCmpt <Pathea.PeTrans>(); v.position = (Vector3)varRef.Value; } return(true); }