本文整理汇总了C#中Mooege.Core.GS.Common.Types.Math.Vector3D类的典型用法代码示例。如果您正苦于以下问题:C# Vector3D类的具体用法?C# Vector3D怎么用?C# Vector3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3D类属于Mooege.Core.GS.Common.Types.Math命名空间,在下文中一共展示了Vector3D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InteractiveNPC
public InteractiveNPC(World world, int actorSNO, Vector3D position)
: base(world, actorSNO, position)
{
this.Attributes[GameAttribute.NPC_Has_Interact_Options, 0] = true;
this.Attributes[GameAttribute.NPC_Is_Operatable] = true;
this.Attributes[GameAttribute.Buff_Visual_Effect, 0x00FFFFF] = true;
}
示例2: Projectile
public Projectile(PowerContext context, int actorSNO, Vector3D position)
: base(context.World, actorSNO)
{
this.Field2 = 0x8;
this.Scale = 1.35f;
// just use default? GBHandle.Projectile is 10, but most projectiles I see use 17
//this.GBHandle.Type = (int)GBHandleType.Projectile; this.GBHandle.GBID = 1;
this.Field7 = 0x00000001;
// these no longer needed?
//this.Field10 = 0x1;
//this.Field11 = 0x1;
//this.Field12 = 0x1;
//this.Field13 = 0x1;
//this.CollFlags = 0x4;
this.Context = context;
this.Position = new Vector3D(position);
this.Timeout = new SecondsTickTimer(context.World.Game, 2f); // 2 second default timeout for projectiles
// copy in important effect params from user
this.Attributes[GameAttribute.Rune_A, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_A, context.PowerSNO];
this.Attributes[GameAttribute.Rune_B, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_B, context.PowerSNO];
this.Attributes[GameAttribute.Rune_C, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_C, context.PowerSNO];
this.Attributes[GameAttribute.Rune_D, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_D, context.PowerSNO];
this.Attributes[GameAttribute.Rune_E, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_E, context.PowerSNO];
_arrivalTime = null;
_lastUpdateTick = 0;
_prevUpdatePosition = null;
_onArrivalCalled = false;
// offset position by mpq collision data
this.Position.Z += this.ActorData.Cylinder.Ax1 - this.ActorData.Cylinder.Position.Z;
}
示例3: Parse
/// <summary>
/// Parses AABB from given GameBitBuffer.
/// </summary>
/// <param name="buffer">The GameBitBuffer to parse from.</param>
public void Parse(GameBitBuffer buffer)
{
Min = new Vector3D();
Min.Parse(buffer);
Max = new Vector3D();
Max.Parse(buffer);
}
示例4: Living
public Living(World world, int actorSNO, Vector3D position, Dictionary<int, TagMapEntry> tags)
: base(world, world.NewActorID, position, tags )
{
this.SNOId = actorSNO;
// FIXME: This is hardcoded crap
this.Field3 = 0x0;
this.RotationAmount = (float)(RandomHelper.NextDouble() * 2.0f * Math.PI);
this.RotationAxis.X = 0f; this.RotationAxis.Y = 0f; this.RotationAxis.Z = 1f;
this.GBHandle.Type = -1; this.GBHandle.GBID = -1;
this.Field7 = 0x00000001;
this.Field8 = this.SNOId;
this.Field10 = 0x0;
this.Field11 = 0x0;
this.Field12 = 0x0;
this.Field13 = 0x0;
this.AnimationSNO = 0x11150;
this.CollFlags = 1;
this.Attributes[GameAttribute.Hitpoints_Max_Total] = 4.546875f;
this.Attributes[GameAttribute.Hitpoints_Max] = 4.546875f;
this.Attributes[GameAttribute.Hitpoints_Total_From_Level] = 0f;
this.Attributes[GameAttribute.Hitpoints_Cur] = 4.546875f;
this.Attributes[GameAttribute.Level] = 1;
}
示例5: TranslateDirection2D
public static Vector3D TranslateDirection2D(Vector3D source, Vector3D destination, Vector3D point, float amount)
{
Vector3D norm = Normalize(new Vector3D(destination.X - source.X, destination.Y - source.Y, 0f));
return new Vector3D(point.X + norm.X * amount,
point.Y + norm.Y * amount,
point.Z);
}
示例6: Parse
public override void Parse(GameBitBuffer buffer)
{
ActorId = buffer.ReadInt(32);
if (buffer.ReadBool())
{
Position = new Vector3D();
Position.Parse(buffer);
}
if (buffer.ReadBool())
{
Angle = buffer.ReadFloat32();
}
if (buffer.ReadBool())
{
TurnImmediately = buffer.ReadBool();
}
if (buffer.ReadBool())
{
Speed = buffer.ReadFloat32();
}
if (buffer.ReadBool())
{
Field5 = buffer.ReadInt(25);
}
if (buffer.ReadBool())
{
AnimationTag = buffer.ReadInt(21) + (-1);
}
if (buffer.ReadBool())
{
Field7 = buffer.ReadInt(32);
}
}
示例7: Parse
/// <summary>
/// Reads PRTransform from given GameBitBuffer.
/// </summary>
/// <param name="buffer">The GameBitBuffer to parse from.</param>
public void Parse(GameBitBuffer buffer)
{
Quaternion = new Quaternion();
Quaternion.Parse(buffer);
Vector3D = new Vector3D();
Vector3D.Parse(buffer);
}
示例8: Vendor
public Vendor(World world, int actorSNO, Vector3D position, Dictionary<int, TagMapEntry> tags)
: base(world, actorSNO, position, tags)
{
this.Attributes[GameAttribute.MinimapActive] = true;
_vendorGrid = new InventoryGrid(this, 1, 20, (int) EquipmentSlotId.Vendor);
PopulateItems();
}
示例9: RunPower
public bool RunPower(Actor user, PowerScript power, Actor target = null,
Vector3D targetPosition = null, TargetMessage targetMessage = null)
{
// replace power with existing channel instance if one exists
if (power is ChanneledSkill)
{
var existingChannel = _FindChannelingSkill(user, power.PowerSNO);
if (existingChannel != null)
{
power = existingChannel;
}
else // new channeled skill, add it to the list
{
_channeledSkills.Add((ChanneledSkill)power);
}
}
// copy in context params
power.User = user;
power.Target = target;
power.World = user.World;
power.TargetPosition = targetPosition;
power.TargetMessage = targetMessage;
_StartScript(power);
return true;
}
示例10: InFrontPostion
protected void InFrontPostion() // spawn actor in front of user
{
float userFacing = (float)Math.Acos(this.User.RotationW) * 2f;
this.SpawnPosition = new Vector3D(User.Position.X + 8 * (float)Math.Cos(userFacing),
User.Position.Y + 8 * (float)Math.Sin(userFacing),
User.Position.Z);
}
示例11: Projectile
private bool _spawned; // using my own spawn flag cause Actor.Spawned isn't being used right now
public Projectile(PowerContext context, int actorSNO, Vector3D position)
: base(context.World, actorSNO)
{
this.Field2 = 0x8;
this.Field7 = 0x00000001; // TODO: test if this is necessary
if (this.Scale == 0f)
this.Scale = 1.00f;
this.Context = context;
this.Position = new Vector3D(position);
// offset position by mpq collision data
this.Position.Z += this.ActorData.Cylinder.Ax1 - this.ActorData.Cylinder.Position.Z;
// 2 second default timeout for projectiles
this.Timeout = new SecondsTickTimer(context.World.Game, 2f);
// copy in important effect params from user
this.Attributes[GameAttribute.Rune_A, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_A, context.PowerSNO];
this.Attributes[GameAttribute.Rune_B, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_B, context.PowerSNO];
this.Attributes[GameAttribute.Rune_C, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_C, context.PowerSNO];
this.Attributes[GameAttribute.Rune_D, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_D, context.PowerSNO];
this.Attributes[GameAttribute.Rune_E, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_E, context.PowerSNO];
_prevUpdatePosition = null;
_mover = new ActorMover(this);
_spawned = false;
}
示例12: Create
public static Actor Create(World world, int snoId, Vector3D position, TagMap tagMap)
{
if (!MPQStorage.Data.Assets[SNOGroup.Actor].ContainsKey(snoId))
return null;
var actorAsset = MPQStorage.Data.Assets[SNOGroup.Actor][snoId];
var actorData = actorAsset.Data as Mooege.Common.MPQ.FileFormats.Actor;
if (actorData == null) return null;
if (actorData.Type == ActorType.Invalid)
return null;
// read tagMapEntries and put them into a dictionary
var tags = tagMap.TagMapEntries.ToDictionary(entry => entry.Int1);
// see if we have an implementation for actor.
if (SNOHandlers.ContainsKey(snoId))
return (Actor) Activator.CreateInstance(SNOHandlers[snoId], new object[] {world, snoId, position, tags});
switch (actorData.Type)
{
case ActorType.Monster:
return new Monster(world, snoId, position, tags);
case ActorType.Gizmo:
return CreateGizmo(world, snoId, position, tags);
}
return null;
}
示例13: CreateGizmo
private static Actor CreateGizmo(World world, int snoId, Vector3D position, Dictionary<int,TagMapEntry> tags)
{
if (tags.ContainsKey((int)MarkerTagTypes.DestinationWorld))
return new Portal(world, snoId, position, tags);
return new Gizmo(world, snoId, position, tags);
}
示例14: Spawn
public void Spawn(float facingAngle = 0)
{
FacingAngle = (float)Math.Cos(facingAngle / 2f);
RotationAxis = new Vector3D(0, 0, (float)Math.Sin(facingAngle / 2f));
this.World.Enter(this);
}
示例15: GetFacingAngle
/// <summary>
/// Returns 2D angle to face the target position.
/// </summary>
/// <param name="lookerPosition">The looker.</param>
/// <param name="targetPosition">The target.</param>
/// <returns></returns>
public static float GetFacingAngle(Vector3D lookerPosition, Vector3D targetPosition)
{
if ((lookerPosition == null) || (targetPosition == null))
return 0f;
return (float) Math.Atan2((targetPosition.Y - lookerPosition.Y), (targetPosition.X - lookerPosition.X));
}