Example #1
0
        public ToggleLimitsButton(Level Target, Surface.SurfaceType Type)
        {
            target = Target;
            type = Type;
            switch (type)
            {
                case Surface.SurfaceType.Absorbant:
                    basicId = "Absorbant Walls: ";
                    break;
                case Surface.SurfaceType.Refractive:
                    basicId = "Refractive Walls: ";
                    break;

                case Surface.SurfaceType.Reflective:
                    basicId = "Reflective Walls: ";
                    break;
                default:
                    basicId = "Whaats?";
                    break;

            }

            addOption(0); addOption(1); addOption(2); addOption(3); addOption(5); addOption(8);
            currentValue = 1;
            execute();
        }
Example #2
0
 public void AddSurface(Surface add)
 {
     adj_surfaces.Add(add);
 }
Example #3
0
        public void ChangeType(Surface.SurfaceType type)
        {
            m_type = type;

            if (m_type == SurfaceType.Reflective) m_color = Color.Silver;
            else if (m_type == SurfaceType.Refractive) m_color = Color.White;
            else m_color = Color.Black;
        }
Example #4
0
 public void RemoveSurface(Surface remove)
 {
     adj_surfaces.Remove(remove);
 }
Example #5
0
        public void Update()
        {
            if (!parent.isFiring())
            {
                position += 15* input.LStickPosition();
            }

            FixPosition();

            if (input.IsCreateTowerNewlyPressed()) region.AddSpawnPoint(new SpawnPoint(position, 1000f, region));

            if (input.IsCancelSurfaceNewlyPressed())
            {
                if (selected_2 != null && !selected_2.built) region.RemoveTower(selected_2);
                if(selected != null && !selected.built) region.RemoveTower(selected);
                selected = null;
                c_build = false;
            }

            if (input.IsIncrementTowerNewlyPressed())
            {
                incrementTowerIndex();
                if (c_build)
                {
                    if (!selected_2.built)
                    {
                        Tower temp = selected_2;
                        selected_2 = parent.m_towers[tower_index];
                        temp_surface.changeTower(selected_2);
                        temp.ClearSurfaces();
                        region.RemoveTower(temp);
                    }
                    else selected_2 = parent.m_towers[tower_index];

                    position = selected_2.position;
                    Vector2 distance = selected.position - position;
                    while (distance.LengthSquared() > 10000)
                    {
                        incrementTowerIndex();
                        selected_2 = parent.m_towers[tower_index];
                        position = selected_2.position;
                        distance = selected.position - position;

                    }
                    temp_surface.changeTower(selected_2);
                }
                else selectTower(parent.m_towers[tower_index]);
            }

            if (input.IsDecrementTowerNewlyPressed())
            {
                decrementTowerIndex();

                if (c_build)
                {
                    if (!selected_2.built){

                        Tower temp = selected_2;
                        selected_2 = parent.m_towers[tower_index];
                        temp_surface.changeTower(selected_2);
                        temp.ClearSurfaces();
                        region.RemoveTower(temp);

                    }else selected_2 = parent.m_towers[tower_index];

                    position = selected_2.position;
                    Vector2 distance = selected.position - position;
                    while (distance.LengthSquared() > 14400)
                    {
                        incrementTowerIndex();
                        selected_2 = parent.m_towers[tower_index];
                        position = selected_2.position;
                        distance = selected.position - position;

                    }
                    temp_surface.changeTower(selected_2);
                }

                else selectTower(parent.m_towers[tower_index]);
            }

               if (c_build)
               {   Vector2 distance = selected.position - position;

               if (distance.LengthSquared() > 14400){
               distance.Normalize();
               position = selected.position - distance * 120f;
               }
               if (!selected_2.built)
               {
                   selected_2.position = position;
               }
               temp_surface.ChangeType(c_build_type);

            }

            if (input.IsCreateSurfaceNewlyPressed() && parent.legalSurface(c_build_type))
            {

                if (c_build)
                {
                    selected.Anchor();
                    selected_2.Anchor();
                    c_temp = Vector2.Zero;
                    temp_surface.built = true;
                        c_build = false;
                        selected.UnHighlight();
                        selected = null;

                        selected_2 = null;
                        temp_surface = null;
                        parent.incrementSurface(c_build_type);

                }else    {
                    if (selected == null) buildTower();
                    else buildTower(selected);

            }

            }

            if (input.IsToggleBuildNewlyPressed())
            {
                region.AddPrism(new AntiPrism(region, position));
            }

            if (input.IsSetReflectiveNewlyPressed() && parent.legalSurface(Surface.SurfaceType.Reflective)) c_build_type = Surface.SurfaceType.Reflective;
            if (input.IsSetAbsorbantNewlyPressed() && parent.legalSurface(Surface.SurfaceType.Absorbant)) c_build_type = Surface.SurfaceType.Absorbant;
            if (input.IsSetRefractiveNewlyPressed() && parent.legalSurface(Surface.SurfaceType.Refractive)) c_build_type = Surface.SurfaceType.Refractive;

            if (input.createPrismNewlyPressed())
            {
                region.AddPrism(position);

            }
        }
Example #6
0
        public void buildTower(Tower built)
        {
            selected_2 = new Tower(parent.id + " " + parent.num_towers, region, position, parent);
            selected_2.built = false;

            region.AddTower(parent.id + " " + parent.num_towers, selected_2);

            parent.m_towers.Add(selected_2);

            parent.num_towers++;

            c_build = true;
            temp_surface = new Surface(selected, selected_2, c_build_type, region);
            temp_surface.built = false;
            region.AddSurface(temp_surface);
        }
Example #7
0
 public virtual void RemoveSurface(Surface remove)
 {
     remove.tower_A.adj_surfaces.Remove(remove);
     remove.tower_B.adj_surfaces.Remove(remove);
     surfaces.Remove(remove);
 }
Example #8
0
 public void SetValue(Surface.SurfaceType type, int amount)
 {
     switch (type)
     {
         case Surface.SurfaceType.Absorbant:
             absorb_limit = amount;
             break;
         case Surface.SurfaceType.Refractive:
             refract_limit = amount;
             break;
         case Surface.SurfaceType.Reflective:
             reflect_limit = amount;
             break;
     }
 }
Example #9
0
 public virtual void AddSurface(Surface add)
 {
     surfaces.Add(add);
     add.loadImage(m_content);
 }
Example #10
0
 public virtual void AddSurface(Surface.SurfaceType type, Vector2 start, Vector2 end)
 {
     surfaces.Add(new Surface(type, start, end));
 }
Example #11
0
        public bool legalSurface(Surface.SurfaceType type)
        {
            switch (type)
            {
                case Surface.SurfaceType.Absorbant:
                    return (absorb_amount < absorb_limit);

                case Surface.SurfaceType.Reflective:
                    return (reflect_amount<reflect_limit) ;
                case Surface.SurfaceType.Refractive:
                    return (refract_amount < refract_limit) ;
                default:
                    return false;
            }
        }
Example #12
0
        public void incrementSurface(Surface.SurfaceType type)
        {
            switch (type)
            {
                case Surface.SurfaceType.Absorbant:
                    absorb_amount++;
                    break;

                case Surface.SurfaceType.Reflective:
                   reflect_amount++;
                   break;
                case Surface.SurfaceType.Refractive:
                    refract_amount++;
                    break;
                default:
                    break;
            }
        }
Example #13
0
        public void decrementSurface(Surface.SurfaceType type)
        {
            switch (type)
            {
                case Surface.SurfaceType.Absorbant:
                    absorb_amount--;
                    if (absorb_amount < 0) absorb_amount = 0;
                    break;

                case Surface.SurfaceType.Reflective:
                    reflect_amount--;
                    if (reflect_amount < 0) reflect_amount = 0;
                    break;

                case Surface.SurfaceType.Refractive:
                    refract_amount++;
                    if (refract_amount < 0) refract_amount = 0;
                    break;
                default:
                    break;
            }
        }