本文整理汇总了C#中GameFramework.EntityInfo.GetId方法的典型用法代码示例。如果您正苦于以下问题:C# EntityInfo.GetId方法的具体用法?C# EntityInfo.GetId怎么用?C# EntityInfo.GetId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameFramework.EntityInfo
的用法示例。
在下文中一共展示了EntityInfo.GetId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreateEntity
private void OnCreateEntity(EntityInfo entity)
{
if (null != entity) {
StorySystem.SendMessage("obj_created", entity.GetId());
StorySystem.SendMessage(string.Format("npc_created:{0}", entity.GetUnitId()), entity.GetId());
}
}
示例2: OnAiAddImpact
private void OnAiAddImpact(EntityInfo entity, int impactId)
{
ImpactInfo impactInfo = new ImpactInfo(impactId);
impactInfo.StartTime = TimeUtility.GetLocalMilliseconds();
impactInfo.ImpactSenderId = entity.GetId();
impactInfo.SkillId = 0;
if (null != impactInfo.ConfigData) {
entity.GetSkillStateInfo().AddImpact(impactInfo);
int seq = impactInfo.Seq;
if (GfxSkillSystem.Instance.StartSkill(entity.GetId(), impactInfo.ConfigData, seq)) {
}
}
}
示例3: BuildCampChangedMessage
internal static Msg_RC_CampChanged BuildCampChangedMessage(EntityInfo obj)
{
Msg_RC_CampChanged msg = new Msg_RC_CampChanged();
msg.obj_id = obj.GetId();
msg.camp_id = obj.GetCampId();
return msg;
}
示例4: BuildNpcFaceMessage
internal static Msg_RC_NpcFace BuildNpcFaceMessage(EntityInfo npc)
{
Msg_RC_NpcFace npcFaceBuilder = new Msg_RC_NpcFace();
npcFaceBuilder.npc_id = npc.GetId();
npcFaceBuilder.face_direction = ProtoHelper.EncodeFloat(npc.GetMovementStateInfo().GetFaceDir());
return npcFaceBuilder;
}
示例5: BuildNpcMoveMessage
internal static Msg_RC_NpcMove BuildNpcMoveMessage(EntityInfo npc)
{
ScriptRuntime.Vector3 srcPos = npc.GetMovementStateInfo().GetPosition3D();
Msg_RC_NpcMove npcMoveBuilder = new Msg_RC_NpcMove();
if (npc.GetMovementStateInfo().IsMoving) {
npcMoveBuilder.npc_id = npc.GetId();
npcMoveBuilder.velocity = ProtoHelper.EncodeFloat(npc.GetActualProperty().MoveSpeed);
ScriptRuntime.Vector3 targetPos = npc.GetMovementStateInfo().TargetPosition;
npcMoveBuilder.target_pos = ProtoHelper.EncodePosition2D(targetPos.X, targetPos.Z);
npcMoveBuilder.cur_pos = ProtoHelper.EncodePosition2D(srcPos.X, srcPos.Z);
} else {
npcMoveBuilder.npc_id = npc.GetId();
npcMoveBuilder.cur_pos = ProtoHelper.EncodePosition2D(srcPos.X, srcPos.Z);
}
return npcMoveBuilder;
}
示例6: BuildCreateNpcMessage
internal static Msg_RC_CreateNpc BuildCreateNpcMessage(EntityInfo npc, int rate = -1)
{
Msg_RC_CreateNpc bder = new Msg_RC_CreateNpc();
bder.npc_id = npc.GetId();
bder.unit_id = npc.GetUnitId();
ScriptRuntime.Vector3 pos = npc.GetMovementStateInfo().GetPosition3D();
GameFrameworkMessage.Position pos_bd = new GameFrameworkMessage.Position();
pos_bd.x = (float)pos.X;
pos_bd.z = (float)pos.Z;
bder.cur_pos = pos_bd;
bder.face_direction = (float)npc.GetMovementStateInfo().GetFaceDir();
bder.link_id = npc.GetLinkId();
bder.camp_id = npc.GetCampId();
if (npc.OwnerId > 0) {
bder.owner_id = npc.OwnerId;
}
if (npc.GetAiStateInfo().LeaderID > 0) {
bder.leader_id = npc.GetAiStateInfo().LeaderID;
}
User user = npc.CustomData as User;
if (null != user) {
bder.key = user.GetKey();
}
bder.level = npc.GetLevel();
return bder;
}
示例7: OnAiFace
private void OnAiFace(EntityInfo entity)
{
if (null != entity && entity.EntityType != (int)EntityTypeEnum.Tower) {
float dir = entity.GetMovementStateInfo().GetFaceDir();
GameObject actor = EntityController.Instance.GetGameObject(entity.GetId());
actor.transform.localRotation = Quaternion.Euler(0, Utility.RadianToDegree(dir), 0);
}
}
示例8: OnAiAddImpact
private void OnAiAddImpact(EntityInfo npc, int impactId)
{
Scene scene = npc.SceneContext.CustomData as Scene;
if (null != scene) {
ImpactInfo impactInfo = new ImpactInfo(impactId);
impactInfo.StartTime = TimeUtility.GetLocalMilliseconds();
impactInfo.ImpactSenderId = npc.GetId();
impactInfo.SkillId = 0;
if (null != impactInfo.ConfigData) {
npc.GetSkillStateInfo().AddImpact(impactInfo);
int seq = impactInfo.Seq;
if (scene.SkillSystem.StartSkill(npc.GetId(), impactInfo.ConfigData, seq)) {
Msg_RC_AddImpact addImpactBuilder = new Msg_RC_AddImpact();
addImpactBuilder.sender_id = npc.GetId();
addImpactBuilder.target_id = npc.GetId();
addImpactBuilder.impact_id = impactId;
addImpactBuilder.skill_id = -1;
addImpactBuilder.duration = impactInfo.DurationTime;
scene.NotifyAllUser(RoomMessageDefine.Msg_RC_AddImpact, addImpactBuilder);
}
}
}
}
示例9: BuildNpcSkillMessage
internal static Msg_RC_NpcSkill BuildNpcSkillMessage(EntityInfo obj, int skillId)
{
MovementStateInfo msi = obj.GetMovementStateInfo();
ScriptRuntime.Vector3 pos = msi.GetPosition3D();
Msg_RC_NpcSkill msg = new Msg_RC_NpcSkill();
msg.npc_id = obj.GetId();
msg.skill_id = skillId;
msg.stand_pos = ProtoHelper.EncodePosition2D(pos.X, pos.Z);
msg.face_direction = ProtoHelper.EncodeFloat(msi.GetFaceDir());
msg.target_id = obj.GetAiStateInfo().Target;
return msg;
}
示例10: BuildSyncNpcOwnerIdMessage
internal static Msg_RC_SyncNpcOwnerId BuildSyncNpcOwnerIdMessage(EntityInfo npc)
{
Msg_RC_SyncNpcOwnerId builder = new Msg_RC_SyncNpcOwnerId();
builder.npc_id = npc.GetId();
builder.owner_id = npc.OwnerId;
return builder;
}
示例11: BuildNpcStopSkillMessage
internal static Msg_RC_NpcStopSkill BuildNpcStopSkillMessage(EntityInfo obj)
{
Msg_RC_NpcStopSkill msg = new Msg_RC_NpcStopSkill();
msg.npc_id = obj.GetId();
return msg;
}
示例12: NotifyAiMeetEnemy
public void NotifyAiMeetEnemy(EntityInfo entity)
{
if (null != OnAiMeetEnemy) {
OnAiMeetEnemy(entity);
}
AiSendStoryMessage(entity, "obj_meet_enemy", entity.GetId());
AiSendStoryMessage(entity, "npc_meet_enemy:" + entity.GetUnitId(), entity.GetId());
}
示例13: DestroyEntity
private void DestroyEntity(EntityInfo ni)
{
m_SkillSystem.StopAllSkill(ni.GetId(), true, true, true);
ni.GetSkillStateInfo().RemoveAllImpact();
OnDestroyEntity(ni);
if (ni.IsCombatNpc()) {
ni.DeadTime = 0;
}
DestroyEntityById(ni.GetId());
}
示例14: DoSkillCommandState
internal static void DoSkillCommandState(EntityInfo entity, long deltaTime, AbstractAiStateLogic logic, int skillId)
{
if (entity.GetMovementStateInfo().IsMoving) {
logic.NotifyAiStopPursue(entity);
}
if (skillId > 0) {
AiStateInfo aiInfo = entity.GetAiStateInfo();
SkillInfo skillInfo = entity.GetSkillStateInfo().GetSkillInfoById(skillId);
if (null != skillInfo) {
if (aiInfo.Target <= 0) {
EntityInfo info;
if (skillInfo.ConfigData.targetType == (int)SkillTargetType.Enemy || skillInfo.ConfigData.targetType == (int)SkillTargetType.RandEnemy) {
info = GetNearstTargetHelper(entity, CharacterRelation.RELATION_ENEMY);
} else {
info = GetNearstTargetHelper(entity, CharacterRelation.RELATION_FRIEND);
}
if (null != info) {
aiInfo.Target = info.GetId();
}
}
if (aiInfo.Target > 0) {
logic.NotifyAiSkill(entity, skillId);
}
}
} else if(!entity.GetSkillStateInfo().IsSkillActivated()) {
logic.AiSendStoryMessage(entity, "npc_skill_finish:" + entity.GetUnitId(), entity.GetId());
logic.AiSendStoryMessage(entity, "obj_skill_finish", entity.GetId());
logic.ChangeToState(entity, (int)AiStateId.Idle);
}
}
示例15: DoPatrolCommandState
internal static void DoPatrolCommandState(EntityInfo entity, long deltaTime, AbstractAiStateLogic logic)
{
AiStateInfo info = entity.GetAiStateInfo();
info.Time += deltaTime;
if (info.Time > 100) {
info.Time = 0;
EntityInfo target = null;
if (info.IsExternalTarget) {
target = AiLogicUtility.GetSeeingLivingCharacterInfoHelper(entity, info.Target);
if (null == target) {
target = AiLogicUtility.GetNearstTargetHelper(entity, CharacterRelation.RELATION_ENEMY);
if (null != target)
info.Target = target.GetId();
}
} else {
target = AiLogicUtility.GetNearstTargetHelper(entity, CharacterRelation.RELATION_ENEMY);
if (null != target)
info.Target = target.GetId();
}
if (null != target) {
logic.AiSendStoryMessage(entity, "obj_patrol_exit", entity.GetId());
logic.AiSendStoryMessage(entity, string.Format("npc_patrol_exit:{0}", entity.GetUnitId()), entity.GetId());
logic.ChangeToState(entity, (int)AiStateId.Idle);
} else {
AiData_ForPatrolCommand data = GetAiDataForPatrolCommand(entity);
if (null != data) {
ScriptRuntime.Vector3 srcPos = entity.GetMovementStateInfo().GetPosition3D();
if (data.PatrolPath.HavePathPoint && !data.PatrolPath.IsReached(srcPos)) {
logic.NotifyAiPursue(entity, data.PatrolPath.CurPathPoint);
} else {
data.PatrolPath.UseNextPathPoint();
if (data.PatrolPath.HavePathPoint) {
logic.NotifyAiPursue(entity, data.PatrolPath.CurPathPoint);
} else {
if (data.IsLoopPatrol) {
logic.AiSendStoryMessage(entity, "obj_patrol_restart", entity.GetId());
logic.AiSendStoryMessage(entity, string.Format("npc_patrol_restart:{0}", entity.GetUnitId()), entity.GetId());
data.PatrolPath.Restart();
} else {
logic.AiSendStoryMessage(entity, "obj_patrol_finish", entity.GetId());
logic.AiSendStoryMessage(entity, string.Format("npc_patrol_finish:{0}", entity.GetUnitId()), entity.GetId());
logic.NotifyAiStopPursue(entity);
logic.ChangeToState(entity, (int)AiStateId.Idle);
}
}
}
info.HomePos = entity.GetMovementStateInfo().GetPosition3D();
} else {
logic.NotifyAiStopPursue(entity);
logic.ChangeToState(entity, (int)AiStateId.Idle);
}
}
}
}