Пример #1
0
        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;
        }
Пример #2
0
 public static void addMaterial(Material mat,int howMuch)
 {
     for(int i =0;i<howMuch;i++)
     {
         materials.Add(mat);
     }
 }
Пример #3
0
        public override void setGaterMaterial(Material m)
        {
            if (m != gaterMaterialObject)
            {
                gaterMaterialObject = m;

            }
        }
Пример #4
0
 public virtual void setGaterMaterial(Material m)
 {
 }
Пример #5
0
 public virtual void gaterMaterial(Material material)
 {
 }
Пример #6
0
        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();
                }

            }
        }
Пример #7
0
        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;
        }
Пример #8
0
 public static void addMaterial(Material material)
 {
     materials.Add(material);
 }