Пример #1
0
 public void AIUpdate(Player player)
 {
     if (active && (player.Position - position).LengthFast < 500 && !hasGoal)
     {
         goalPosition = player.Position;
         hasGoal = true;
         source.Play();
     }
 }
Пример #2
0
        public void AIUpdate(Player player)
        {
            if ((player.Position - position).LengthFast < 300)
            {
                goalPos = player.Position;
                hasGoal = true;

                if (source.State != OpenTK.Audio.OpenAL.ALSourceState.Playing)
                    source.Play();
            }
            else
            {
                if (source.State == OpenTK.Audio.OpenAL.ALSourceState.Playing)
                    source.Stop();

                hasGoal = false;
            }
        }
Пример #3
0
        public void OnLoad(EventArgs e)
        {
            camera = new Camera();
            camera.LoadProjection();
            entities = new List<Entity>();

            player = new Player();
            map = new LevelMap(new Texture("Resources/Levels/" + level + ".png"), new Texture("Resources/Levels/" + level + "_col.png"));

            helpFont = new QFont("Resources/Fonts/anarchysans.ttf", 22);
            helpFont.Options.Colour = Color4.DarkRed;

            using (StreamReader reader = new StreamReader("Resources/Levels/" + level + ".txt"))
            {
                while (!reader.EndOfStream)
                {
                    string line = reader.ReadLine();
                    string[] values = line.Split(' ');
                    Vector2 pos = new Vector2(int.Parse(values[1]), int.Parse(values[2]));

                    switch (values[0])
                    {
                        case "Spawn":
                            player.Position = pos;
                            player.Position = pos;
                            break;
                        case "Generator":
                            generator = new Generator(pos);
                            entities.Add(generator);
                            break;
                        case "Lift":
                            lift = new Lift(pos);
                            entities.Add(lift);
                            break;
                        case "Pickaxe":
                            entities.Add(new Pickaxe(pos, 0, true));
                            break;
                        case "PickaxeB":
                            entities.Add(new Pickaxe(pos, 0, false));
                            break;
                        case "Skeleton":
                            entities.Add(new Skeleton(0, pos));
                            break;
                        case "Goblin":
                            entities.Add(new Goblin(pos));
                            break;
                        case "GameEnd":
                            entities.Add(new Endgame(pos));
                            break;
                    }
                }
            }

            fadeIn = new Mesh(1024, 768, Texture.Zero);
            fadePercent = 1f;
            fadingIn = true;

            GL.Enable(EnableCap.Blend);
            GL.Enable(EnableCap.Texture2D);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
        }