public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value.GetType() != typeof(BindPoint)) { throw new InvalidCastException("Input is not valid BindPoint."); } if (parameter == null) { parameter = 1; } else if (parameter.GetType() != typeof(int)) { throw new InvalidCastException("Parameter is not a valid int."); } int size = (int)parameter; BindPoint point = (BindPoint)value; int x = (int)point.X / size; int y = (int)point.Y / size; IntPoint intPoint = new IntPoint(x, y); return(intPoint); }
public CardBase() { Pos2GridConv = new CardPosition2CardGridConverter(); RotationState = CardRotation.Deg0; GridPosition = new IntPoint(-1, -1); Position = new BindPoint(); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (value.GetType() != typeof(IntPoint)) { throw new InvalidCastException("Input is not a valid IntPoint."); } if (parameter == null) { parameter = 1; } else if (parameter.GetType() != typeof(int)) { throw new InvalidCastException("Parameter is not a valid int."); } int size = (int)parameter; IntPoint intPoint = (IntPoint)value; double x = intPoint.X * size; double y = intPoint.Y * size; BindPoint point = new BindPoint(x, y); return(point); }
public void Add(BindPoint point) { if (NotAlreadyInGraph(point)) { nodes.Add(new BindingNode(point)); } }
public void OnCommand(GameClient client, string[] args) { ushort bindRadius = 750; if (args.Length >= 2) { try { bindRadius = ushort.Parse(args[1]); } catch (Exception e) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.Error", e.Message)); return; } } BindPoint bp = new BindPoint(); bp.X = client.Player.X; bp.Y = client.Player.Y; bp.Z = client.Player.Z; bp.Region = client.Player.CurrentRegionID; bp.Radius = bindRadius; GameServer.Database.AddObject(bp); client.Player.CurrentRegion.AddArea(new Area.BindArea("bind point", bp)); DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "GMCommands.AddBind.BindPointAdded", bp.X, bp.Y, bp.Z, bp.Radius, bp.Region)); }
private BindingNode FindNodeForPoint(BindPoint point) { /* * Find the BindingNode associated with a particular BindPoint */ return(nodes.First(x => x.Vertex.Equals(point))); }
/// <summary> /// Is player allowed to bind /// </summary> /// <param name="player"></param> /// <param name="point"></param> /// <returns></returns> public override bool IsAllowedToBind(GamePlayer player, BindPoint point) { if (point.Realm == 0) { return(true); } return(player.Realm == (eRealm)point.Realm); }
public void TwoWayBind(BindPoint first, BindPoint second) { /* * Link the two nodes in both directions */ Bind(first, second); Bind(second, first); }
public void Bind(BindPoint first, BindPoint second) { /* * Link the two nodes in one direction */ BindingNode firstNode = FindNodeForPoint(first); BindingNode secondNode = FindNodeForPoint(second); firstNode.AddEdgeTo(secondNode); }
public override void LoadFromDatabase(DBArea area) { base.LoadFromDatabase(area); m_dbBindPoint = new BindPoint(); m_dbBindPoint.Radius = (ushort)area.Radius; m_dbBindPoint.X = area.X; m_dbBindPoint.Y = area.Y; m_dbBindPoint.Z = area.Z; m_dbBindPoint.Region = area.Region; }
public Npc Clone() { Npc clone = new Npc { NpcId = NpcId, SpawnTemplate = SpawnTemplate, NpcTemplate = NpcTemplate, Position = Position.Clone(), BindPoint = BindPoint.Clone(), }; return(clone); }
public override void LoadFromDatabase(DBArea area) { base.LoadFromDatabase(area); BindPoint = new BindPoint { Radius = (ushort)area.Radius, X = area.X, Y = area.Y, Z = area.Z, Region = area.Region }; }
public static void Run() { // ExStart:AddAnimationPropertyToDocument // Initialize scene object Scene scene = new Scene(); // Call Common class create mesh using polygon builder method to set mesh instance Mesh mesh = Common.CreateMeshUsingPolygonBuilder(); // Each cube node has their own translation Node cube1 = scene.RootNode.CreateChildNode("cube1", mesh); // Find translation property on node's transform object Property translation = cube1.Transform.FindProperty("Translation"); // Create a bind point based on translation property BindPoint bindPoint = new BindPoint(scene, translation); // Create the animation curve on X component of the scale bindPoint.BindKeyframeSequence("X", new KeyframeSequence() { // Move node's translation to (10, 0, 10) at 0 sec using bezier interpolation { 0, 10.0f, Interpolation.Bezier }, // Move node's translation to (20, 0, -10) at 3 sec { 3, 20.0f, Interpolation.Bezier }, // Move node's translation to (30, 0, 0) at 5 sec { 5, 30.0f, Interpolation.Linear }, }); // Create the animation curve on Z component of the scale bindPoint.BindKeyframeSequence("Z", new KeyframeSequence() { // Move node's translation to (10, 0, 10) at 0 sec using bezier interpolation { 0, 10.0f, Interpolation.Bezier }, // Move node's translation to (20, 0, -10) at 3 sec { 3, -10.0f, Interpolation.Bezier }, // Move node's translation to (30, 0, 0) at 5 sec { 5, 0.0f, Interpolation.Linear }, }); // The path to the documents directory. string output = RunExamples.GetOutputFilePath("PropertyToDocument.fbx"); // Save 3D scene in the supported file formats scene.Save(output, FileFormat.FBX7500ASCII); // ExEnd:AddAnimationPropertyToDocument Console.WriteLine("\nAnimation property added successfully to document.\nFile saved at " + output); }
public void MultiBind(BindPoint[] sources, BindPoint[] destinations) { /* * Link all sources to all destinations (possibly an over-estimate but ensures safety * in checking for conflicts) */ foreach (BindPoint source in sources) { foreach (BindPoint dest in destinations) { Bind(source, dest); } } }
public void RemoveBindings(BindPoint[] sources, BindPoint[] destinations) { /* * Remove all bindings between the sources and the destinations */ foreach (BindPoint source in sources) { BindingNode node = FindNodeForPoint(source); node.AdjacentNodes.RemoveAll((BindingNode n) => destinations.Contains(n.Vertex)); } }
public BindingNode(BindPoint point) { Vertex = point; AdjacentNodes = new List<BindingNode>(); }
public bool NotAlreadyInGraph(BindPoint point) { return nodes.Where(x => x.Vertex.Equals(point)).FirstOrDefault() == null; }
public bool NotAlreadyInGraph(BindPoint point) { return(nodes.Where(x => x.Vertex.Equals(point)).FirstOrDefault() == null); }
public void TwoWayMultiBind(BindPoint[] firsts, BindPoint[] seconds) { /* * Link all sources to all destinations in both directions */ MultiBind(firsts, seconds); MultiBind(seconds, firsts); }
public BindingNode(BindPoint point) { Vertex = point; AdjacentNodes = new List <BindingNode>(); }
public BindArea(string desc, BindPoint dbBindPoint) : base(desc, dbBindPoint.X, dbBindPoint.Y, dbBindPoint.Z, dbBindPoint.Radius) { BindPoint = dbBindPoint; DisplayMessage = false; }
private BindingNode FindNodeForPoint(BindPoint point) { /* * Find the BindingNode associated with a particular BindPoint */ return nodes.First(x => x.Vertex.Equals(point)); }