本文整理汇总了C#中EntityInfo.GetMovementStateInfo方法的典型用法代码示例。如果您正苦于以下问题:C# EntityInfo.GetMovementStateInfo方法的具体用法?C# EntityInfo.GetMovementStateInfo怎么用?C# EntityInfo.GetMovementStateInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityInfo
的用法示例。
在下文中一共展示了EntityInfo.GetMovementStateInfo方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStateLogicInit
protected override void OnStateLogicInit(EntityInfo npc, long deltaTime)
{
AiStateInfo info = npc.GetAiStateInfo();
info.Time = 0;
info.HomePos = npc.GetMovementStateInfo().GetPosition3D();
info.Target = 0;
NotifyAiInitDslLogic(npc);
}
示例2: Init
private void Init(EntityInfo obj, EntityInfo target, SkillInstance instance)
{
CopySectionList();
CalNewSpeedWithTarget(obj, target, instance);
m_Now = instance.CurTime / 1000.0f;
m_SectionListCopy[0].startTime = m_Now;
m_SectionListCopy[0].lastUpdateTime = m_Now;
m_SectionListCopy[0].curSpeedVect = m_SectionListCopy[0].speedVect;
m_StartPos = obj.GetMovementStateInfo().GetPosition3D();
m_StartDir = obj.GetMovementStateInfo().GetFaceDir();
m_IsInited = true;
}
示例3: CalNewSpeedWithTarget
private void CalNewSpeedWithTarget(EntityInfo obj, EntityInfo target, SkillInstance instance)
{
if (null == obj || null == target)
return;
Vector3 srcPos = obj.GetMovementStateInfo().GetPosition3D();
Vector3 targetPos = target.GetMovementStateInfo().GetPosition3D();
obj.GetMovementStateInfo().SetFaceDir(Geometry.GetYRadian(new Vector2(srcPos.X, srcPos.Z), new Vector2(targetPos.X, targetPos.Z)));
float cur_distance_z = 0;
for (int i = 0; i < m_SectionListCopy.Count; i++) {
cur_distance_z += (m_SectionListCopy[i].speedVect.Z * m_SectionListCopy[i].moveTime +
m_SectionListCopy[i].accelVect.Z * m_SectionListCopy[i].moveTime * m_SectionListCopy[i].moveTime / 2.0f);
}
Vector3 target_motion = (targetPos - srcPos);
target_motion.Y = 0;
float target_distance_z = target_motion.Length();
float speed_ratio = 1;
if (cur_distance_z != 0) {
speed_ratio = target_distance_z / cur_distance_z;
}
for (int i = 0; i < m_SectionListCopy.Count; i++) {
m_SectionListCopy[i].speedVect.Z *= speed_ratio;
m_SectionListCopy[i].accelVect.Z *= speed_ratio;
}
}
示例4: SetTransformRelativeSelf
private void SetTransformRelativeSelf(EntityInfo obj)
{
Vector3 new_pos = TriggerUtil.TransformPoint(obj.GetMovementStateInfo().GetPosition3D(), m_Postion, obj.GetMovementStateInfo().GetFaceDir());
TriggerUtil.MoveObjTo(obj, new_pos);
float dir = obj.GetMovementStateInfo().GetFaceDir();
float radian = (dir + Geometry.DegreeToRadian((Helper.Random.NextFloat() - 0.5f) * m_Rotate.Y)) % (float)(Math.PI * 2);
obj.GetMovementStateInfo().SetFaceDir(radian);
}
示例5: AttachToObjectForRandomRotate
private void AttachToObjectForRandomRotate(EntityInfo obj, EntityInfo owner)
{
Vector3 world_pos = TriggerUtil.TransformPoint(owner.GetMovementStateInfo().GetPosition3D(), m_Postion, owner.GetMovementStateInfo().GetFaceDir());
TriggerUtil.MoveObjTo(obj, world_pos);
float dir = obj.GetMovementStateInfo().GetFaceDir();
float radian = (dir + Geometry.DegreeToRadian((Helper.Random.NextFloat() - 0.5f) * m_RandomRotate.Y)) % (float)(Math.PI * 2);
obj.GetMovementStateInfo().SetFaceDir(radian);
}
示例6: AttachToObject
private void AttachToObject(EntityInfo obj, EntityInfo owner)
{
Vector3 world_pos = TriggerUtil.TransformPoint(owner.GetMovementStateInfo().GetPosition3D(), m_Postion, owner.GetMovementStateInfo().GetFaceDir());
TriggerUtil.MoveObjTo(obj, world_pos);
}
示例7: MoveObjTo
internal static void MoveObjTo(EntityInfo obj, Vector3 position)
{
obj.GetMovementStateInfo().SetPosition(position);
}
示例8: Lookat
internal static void Lookat(Scene scene, EntityInfo obj, Vector3 target)
{
if (scene.EntityController.GetEntityType(obj) == (int)EntityTypeEnum.Tower)
return;
Vector3 srcPos = obj.GetMovementStateInfo().GetPosition3D();
obj.GetMovementStateInfo().SetFaceDir(Geometry.GetYRadian(new Vector2(srcPos.X, srcPos.Z), new Vector2(target.X, target.Z)));
}
示例9: GetObjFaceDir
internal static float GetObjFaceDir(EntityInfo obj)
{
return obj.GetMovementStateInfo().GetFaceDir();
}
示例10: GetHeightWithGround
internal static float GetHeightWithGround(EntityInfo obj)
{
return GetHeightWithGround(obj.GetMovementStateInfo().GetPosition3D());
}
示例11: AoeQuery
public static void AoeQuery(Scene scene, EntityInfo srcObj, EntityInfo targetObj, int aoeType, float range, float angleOrLength, SkillInstance instance, int senderId, int targetType, Vector3 relativeCenter, bool relativeToTarget, MyFunc<float, int, bool> callback)
{
float radian;
Vector3 center;
Vector3 srcPos = srcObj.GetMovementStateInfo().GetPosition3D();
if (null != targetObj && relativeToTarget) {
Vector3 targetPos = targetObj.GetMovementStateInfo().GetPosition3D();
radian = Geometry.GetYRadian(new ScriptRuntime.Vector2(srcPos.X, srcPos.Z), new ScriptRuntime.Vector2(targetPos.X, targetPos.Z));
ScriptRuntime.Vector2 newOffset = Geometry.GetRotate(new ScriptRuntime.Vector2(relativeCenter.X, relativeCenter.Z), radian);
center = targetPos + new Vector3(newOffset.X, relativeCenter.Y, newOffset.Y);
} else {
radian = srcObj.GetMovementStateInfo().GetFaceDir();
ScriptRuntime.Vector2 newOffset = Geometry.GetRotate(new ScriptRuntime.Vector2(relativeCenter.X, relativeCenter.Z), radian);
center = srcPos + new Vector3(newOffset.X, relativeCenter.Y, newOffset.Y);
}
if (aoeType == (int)SkillAoeType.Circle || aoeType == (int)SkillAoeType.Sector) {
angleOrLength = Geometry.DegreeToRadian(angleOrLength);
scene.KdTree.Query(center.X, center.Y, center.Z, range, (float distSqr, KdTreeObject kdTreeObj) => {
int targetId = kdTreeObj.Object.GetId();
if (targetType == (int)SkillTargetType.Enemy && CharacterRelation.RELATION_ENEMY == scene.EntityController.GetRelation(senderId, targetId) ||
targetType == (int)SkillTargetType.Friend && CharacterRelation.RELATION_FRIEND == scene.EntityController.GetRelation(senderId, targetId)) {
bool isMatch = false;
if (aoeType == (int)SkillAoeType.Circle) {
isMatch = true;
} else {
ScriptRuntime.Vector2 u = Geometry.GetRotate(new ScriptRuntime.Vector2(0, 1), radian);
isMatch = Geometry.IsSectorDiskIntersect(new ScriptRuntime.Vector2(center.X, center.Z), u, angleOrLength / 2, range, new ScriptRuntime.Vector2(kdTreeObj.Position.X, kdTreeObj.Position.Z), kdTreeObj.Radius);
}
if (isMatch) {
if (!callback(distSqr, kdTreeObj.Object.GetId())) {
return false;
}
}
}
return true;
});
} else {
ScriptRuntime.Vector2 angleu = Geometry.GetRotate(new ScriptRuntime.Vector2(0, angleOrLength), radian);
ScriptRuntime.Vector2 c = new ScriptRuntime.Vector2(center.X, center.Z) + angleu / 2;
scene.KdTree.Query(c.X, 0, c.Y, range + angleOrLength / 2, (float distSqr, GameFramework.KdTreeObject kdTreeObj) => {
int targetId = kdTreeObj.Object.GetId();
if (targetType == (int)SkillTargetType.Enemy && CharacterRelation.RELATION_ENEMY == scene.EntityController.GetRelation(senderId, targetId) ||
targetType == (int)SkillTargetType.Friend && CharacterRelation.RELATION_FRIEND == scene.EntityController.GetRelation(senderId, targetId)) {
bool isMatch = false;
if (aoeType == (int)SkillAoeType.Capsule) {
isMatch = Geometry.IsCapsuleDiskIntersect(new ScriptRuntime.Vector2(center.X, center.Z), angleu, range, new ScriptRuntime.Vector2(kdTreeObj.Position.X, kdTreeObj.Position.Z), kdTreeObj.Radius);
} else {
ScriptRuntime.Vector2 half = new ScriptRuntime.Vector2(range / 2, angleOrLength / 2);
isMatch = Geometry.IsObbDiskIntersect(c, half, radian, new ScriptRuntime.Vector2(kdTreeObj.Position.X, kdTreeObj.Position.Z), kdTreeObj.Radius);
}
if (isMatch) {
if (!callback(distSqr, kdTreeObj.Object.GetId())) {
return false;
}
}
}
return true;
});
}
}