public override void gaterMaterial(Material material) { if (elapsedTime >= gaterTime) { if (material.Model.Scale.X > 0 && capacity < maxCapacity) { switch (material.GetType().Name) { case "Log": materials.Add(new Wood()); wood2++; ((Log)material).removeWood(1); ((Log)material).Model.Scale = new Vector3((float)((float)((Log)material).ClusterSize / (float)((Log)material).MaxClusterSize)) * material.Model.Scale; break; case "Rock": materials.Add(new Stone()); rock2++; ((Rock)material).removeRock(1); ((Rock)material).Model.Scale = new Vector3((float)((float)((Rock)material).ClusterSize / (float)((Rock)material).MaxClusterSize)) * material.Model.Scale; break; } capacity++; } } elapsedTime = 0.0f; }
public static void addMaterial(Material mat,int howMuch) { for(int i =0;i<howMuch;i++) { materials.Add(mat); } }
public override void setGaterMaterial(Material m) { if (m != gaterMaterialObject) { gaterMaterialObject = m; } }
public virtual void setGaterMaterial(Material m) { }
public virtual void gaterMaterial(Material material) { }
public override void setGaterMaterial(Material m) { if (m != gaterMaterialObject) { if(m==null) { gaterMaterialObject = null; return; } float distance = float.MaxValue; Node nearest = new Node(); gaterMaterialObject = m; foreach (Node n in m.nodes) { if (distance > Vector2.Distance(n.centerPosition, new Vector2(model.Position.X, model.Position.Z))) { distance = Vector2.Distance(n.centerPosition, new Vector2(model.Position.X, model.Position.Z)); nearest = n; } } PathFinder.SearchNearest(ref nearest); if (PathFinder.Search(myNode, nearest)) { MovementPath = new Queue<Node>(PathFinder.finalPath); Moving = true; PathFinder.finalPath.Clear(); } } }
public override void gaterMaterial(Material material) { if (capacity < maxCapacity) { // Console.WriteLine(material.GetType().Name); switch (material.GetType().Name) { case "Log": //this.model.playerTarget.X = material.Model.Position.X; // this.model.playerTarget.Z = material.Model.Position.Z; this.destination = new Vector2(material.Model.Position.X, material.Model.Position.Z); materials.Add(new Wood()); wood2++; //material.ClusterSize--; ((Log)material).removeWood(1); ((Log)material).Model.Scale = new Vector3((float)((float)((Log)material).ClusterSize / (float)((Log)material).MaxClusterSize));// * material.Model.Scale; break; case "Rock": //this.model.playerTarget.X = material.Model.Position.X; //this.model.playerTarget.Z = material.Model.Position.Z; this.destination = new Vector2(material.Model.Position.X, material.Model.Position.Z); materials.Add(new Stone()); rock2++; //((Rock)material).ClusterSize--; ((Rock)material).removeRock(1); ((Rock)material).Model.Scale = new Vector3((float)((float)((Rock)material).ClusterSize / (float)((Rock)material).MaxClusterSize));//*material.Model.Scale; break; } capacity++; } else { ImGatering = false; } elapsedTime = 0.0f; }
public static void addMaterial(Material material) { materials.Add(material); }