本文整理汇总了C#中StorySystem.StoryInstance类的典型用法代码示例。如果您正苦于以下问题:C# StoryInstance类的具体用法?C# StoryInstance怎么用?C# StoryInstance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StoryInstance类属于StorySystem命名空间,在下文中一共展示了StoryInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
protected override void Evaluate(StoryInstance instance, object iterator, object[] args)
{
m_ObjPath.Evaluate(instance, iterator, args);
m_ComponentType.Evaluate(instance, iterator, args);
if (m_HaveObj) {
m_ObjVarName.Evaluate(instance, iterator, args);
}
}
示例2: Evaluate
protected override void Evaluate(StoryInstance instance, object iterator, object[] args)
{
m_MsgId.Evaluate(instance, iterator, args);
for (int i = 0; i < m_MsgArgs.Count; ++i) {
IStoryValue<object> val = m_MsgArgs[i];
val.Evaluate(instance, iterator, args);
}
}
示例3: ExecCommand
protected override bool ExecCommand(StoryInstance instance, long delta)
{
int objId = m_ObjId.Value;
string value = m_Value.Value;
EntityInfo charObj = ClientModule.Instance.GetEntityById(objId);
if (null != charObj) {
charObj.IsControlByStory = (0 == value.CompareTo("true"));
}
return false;
}
示例4: Evaluate
protected override void Evaluate(StoryInstance instance, object iterator, object[] args)
{
m_Pos.Evaluate(instance, iterator, args);
m_Radius.Evaluate(instance, iterator, args);
m_Type.Evaluate(instance, iterator, args);
m_EventName.Evaluate(instance, iterator, args);
if (m_HaveSet) {
m_SetVar.Evaluate(instance, iterator, args);
m_SetVal.Evaluate(instance, iterator, args);
m_ElseSetVal.Evaluate(instance, iterator, args);
}
}
示例5: ExecCommand
protected override bool ExecCommand(StoryInstance instance, long delta)
{
Scene scene = instance.Context as Scene;
if (null != scene) {
int objId = m_ObjId.Value;
string value = m_Value.Value;
EntityInfo charObj = scene.SceneContext.GetEntityById(objId);
if (null != charObj) {
charObj.IsControlByStory = (0 == value.CompareTo("true"));
}
}
return false;
}
示例6: Execute
public bool Execute(StoryInstance instance, long delta, object iterator, object[] args)
{
if (IsCompositeCommand) {
return ExecCommand(instance, delta, iterator, args);
} else {
if (!m_LastExecResult) {
//重复执行时不需要每个tick都更新变量值,每个命令每次执行,变量值只读取一次。
Evaluate(instance, iterator, args);
}
m_LastExecResult = ExecCommand(instance, delta);
return m_LastExecResult;
}
}
示例7: ExecCommand
protected override bool ExecCommand(StoryInstance instance, long delta)
{
Scene scene = instance.Context as Scene;
if (null != scene) {
int objId = 0;
if (m_ParamNum >= 5) {
Vector3 pos = m_Pos.Value;
float dir = m_Dir.Value;
int camp = m_Camp.Value;
int linkId = m_LinkId.Value;
objId = scene.CreateEntity(m_UnitId.Value, pos.X, pos.Y, pos.Z, dir, camp, linkId);
if (m_ParamNum > 6) {
int aiLogic = m_AiLogic.Value;
EntityInfo charObj = scene.SceneContext.GetEntityById(objId);
if (null != charObj) {
charObj.GetAiStateInfo().Reset();
charObj.GetAiStateInfo().AiLogic = aiLogic;
if (m_ParamNum > 7) {
int leaderId = m_LeaderId.Value;
charObj.GetAiStateInfo().LeaderID = leaderId;
} else {
charObj.GetAiStateInfo().LeaderID = 0;
}
IEnumerable aiParams = m_AiParams.Value;
int ix = 0;
foreach (string aiParam in aiParams) {
if (ix < AiStateInfo.c_MaxAiParamNum) {
charObj.GetAiStateInfo().AiParam[ix] = aiParam;
++ix;
} else {
break;
}
}
}
}
EntityInfo obj = scene.GetEntityById(objId);
if (null != obj) {
Msg_RC_CreateNpc msg = DataSyncUtility.BuildCreateNpcMessage(obj);
scene.NotifyAllUser(RoomMessageDefine.Msg_RC_CreateNpc, msg);
}
}
if (m_HaveObjId) {
string varName = m_ObjIdVarName.Value;
instance.SetVariable(varName, objId);
}
}
return false;
}
示例8: ExecCommand
protected override bool ExecCommand(StoryInstance instance, long delta)
{
UserThread userThread = instance.Context as UserThread;
if (null != userThread) {
string msgId = m_MsgId.Value;
ArrayList arglist = new ArrayList();
for (int i = 0; i < m_MsgArgs.Count; ++i) {
IStoryValue<object> val = m_MsgArgs[i];
arglist.Add(val.Value);
}
object[] args = arglist.ToArray();
userThread.StorySystem.SendMessage(msgId, args);
}
return false;
}
示例9: ExecCommand
protected override bool ExecCommand(StoryInstance instance, long delta)
{
bool triggered = false;
string name = m_Name.Value;
float radius = m_Radius.Value;
string type = m_Type.Value;
string eventName = m_EventName.Value;
UnityEngine.GameObject obj = UnityEngine.GameObject.Find(name);
if (null != obj) {
UnityEngine.Vector3 pos = obj.transform.position;
if (type == "myself") {
EntityViewModel view = EntityController.Instance.GetEntityViewById(ClientModule.Instance.LeaderID);
if (null != view && null != view.Actor) {
if ((view.Actor.transform.position - pos).sqrMagnitude < radius * radius) {
GfxStorySystem.Instance.SendMessage(eventName, name, radius, type);
triggered = true;
}
}
} else if (type == "anyenemy" || type == "anyfriend") {
EntityInfo myself = ClientModule.Instance.GetEntityById(ClientModule.Instance.LeaderID);
ClientModule.Instance.KdTree.Query(pos.x, pos.y, pos.z, radius, (float distSqr, KdTreeObject kdObj) => {
if (type == "anyenemy" && EntityInfo.GetRelation(myself, kdObj.Object) == CharacterRelation.RELATION_ENEMY ||
type == "anyfriend" && EntityInfo.GetRelation(myself, kdObj.Object) == CharacterRelation.RELATION_FRIEND) {
GfxStorySystem.Instance.SendMessage(eventName, name, radius, type);
triggered = true;
return false;
}
return true;
});
}
}
string varName = m_SetVar.Value;
object varVal = m_SetVal.Value;
object elseVal = m_ElseSetVal.Value;
if (triggered) {
instance.SetVariable(varName, varVal);
} else {
instance.SetVariable(varName, elseVal);
}
return false;
}
示例10: Evaluate
protected override void Evaluate(StoryInstance instance, object iterator, object[] args)
{
if (m_ParamNum >= 5) {
m_UnitId.Evaluate(instance, iterator, args);
m_Pos.Evaluate(instance, iterator, args);
m_Dir.Evaluate(instance, iterator, args);
m_Camp.Evaluate(instance, iterator, args);
m_LinkId.Evaluate(instance, iterator, args);
if (m_ParamNum > 6) {
m_AiLogic.Evaluate(instance, iterator, args);
m_AiParams.Evaluate(instance, iterator, args);
if (m_ParamNum > 7) {
m_LeaderId.Evaluate(instance, iterator, args);
}
}
}
if (m_HaveObjId) {
m_ObjIdVarName.Evaluate(instance, iterator, args);
}
}
示例11: ExecCommand
protected override bool ExecCommand(StoryInstance instance, long delta)
{
UserThread userThread = instance.Context as UserThread;
if (null != userThread) {
string key = m_Key.Value;
object val = m_Value.Value;
if (val is int) {
int v = (int)val;
GlobalData.Instance.AddInt(key, v);
} else if (val is float) {
float v = (float)val;
GlobalData.Instance.AddFloat(key, v);
} else {
string v = val as string;
if (null == v)
v = string.Empty;
GlobalData.Instance.AddStr(key, v);
}
}
return false;
}
示例12: ExecCommand
protected override bool ExecCommand(StoryInstance instance, long delta)
{
Scene scene = instance.Context as Scene;
if (null != scene) {
bool triggered = false;
Vector3 pos = m_Pos.Value;
float radius = m_Radius.Value;
string type = m_Type.Value;
string eventName = m_EventName.Value;
if (type == "user") {
scene.KdTree.Query(pos, radius, (float distSqr, KdTreeObject kdObj) => {
if (kdObj.Object.EntityType != (int)EntityTypeEnum.Hero) {
scene.StorySystem.SendMessage(eventName, pos, radius, type);
triggered = true;
return false;
}
return true;
});
} else if (type == "npc") {
scene.KdTree.Query(pos, radius, (float distSqr, KdTreeObject kdObj) => {
if (kdObj.Object.EntityType != (int)EntityTypeEnum.Hero) {
scene.StorySystem.SendMessage(eventName, pos, radius, type);
triggered = true;
return false;
}
return true;
});
}
string varName = m_SetVar.Value;
object varVal = m_SetVal.Value;
object elseVal = m_ElseSetVal.Value;
if (triggered) {
instance.SetVariable(varName, varVal);
} else {
instance.SetVariable(varName, elseVal);
}
}
return false;
}
示例13: ExecCommand
protected override bool ExecCommand(StoryInstance instance, long delta)
{
string objPath = m_ObjPath.Value;
object componentType = m_ComponentType.Value;
UnityEngine.GameObject obj = UnityEngine.GameObject.Find(objPath);
if (null != obj) {
UnityEngine.Component component = null;
Type t = componentType as Type;
if (null != t) {
component = obj.AddComponent(t);
} else {
string name = componentType as string;
if (null != name) {
t = Type.GetType(name);
component = obj.AddComponent(t);
}
}
if (m_HaveObj) {
string varName = m_ObjVarName.Value;
instance.SetVariable(varName, component);
}
}
return false;
}
示例14: ExecCommand
protected override bool ExecCommand(StoryInstance instance, long delta)
{
Scene scene = instance.Context as Scene;
if (null != scene) {
int sceneId = m_TargetSceneId.Value;
object idObj = m_ObjId.Value;
if (idObj is int) {
int objId = (int)idObj;
EntityInfo entity = scene.GetEntityById(objId);
if (null != entity) {
User us = entity.CustomData as User;
if (null != us) {
RoomServer.RoomServer.Instance.PlayerRequestActiveRoom(sceneId, us.Guid);
}
}
} else {
IList<int> list = idObj as IList<int>;
if (null != list) {
List<ulong> guids = new List<ulong>();
for (int i = 0; i < list.Count; ++i) {
EntityInfo entity = scene.GetEntityById(list[i]);
if (null != entity) {
User us = entity.CustomData as User;
if (null != us) {
guids.Add(us.Guid);
}
}
}
if (guids.Count > 0) {
RoomServer.RoomServer.Instance.PlayerRequestActiveRoom(sceneId, guids.ToArray());
}
}
}
}
return false;
}
示例15: Evaluate
protected override void Evaluate(StoryInstance instance, object iterator, object[] args)
{
m_Key.Evaluate(instance, iterator, args);
m_Type.Evaluate(instance, iterator, args);
}