예제 #1
0
 public override void OnUpdate()
 {
     if (play)
     {
         move(p);
         move(p2);
         check(p);
         check(p2);
         foreach (Line l in LineRenderStack)
         {
             if (p.IsInArea(l.StartPoint, new Vector(2, 2)) && l.color == Color.Lime)
             {
                 p.DestroySelf();
                 play = false;
                 Text t = new Text("Green wins", new Vector(300, 250), Color.White, 20);
                 Thread.Sleep(2000);
                 t.DestroySelf();
             }
             if (p2.IsInArea(l.StartPoint, new Vector(2, 2)) && l.color == Color.Red)
             {
                 p2.DestroySelf();
                 play = false;
                 Text t = new Text("Red wins", new Vector(350, 150), Color.White, 20);
                 Thread.Sleep(2000);
                 t.DestroySelf();
             }
         }
     }
     else
     {
         p.Position = new Vector(120, 250);
         p.CreateSelf();
         p2.Position = new Vector(700, 250);
         p2.CreateSelf();
         LineRenderStack.Clear();
         play = true;
     }
 }
예제 #2
0
        public override void OnUpdate()
        {
            //Line.TurnShapeIntoLineHitbox(p);
            //Prefabs.PlayerControler(p, 3);
            Line l = new Line(new Vector(p.Position.X, p.Position.Y), new Vector(p.Position.X + 1, p.Position.Y), Color.Black);

            l.LifeTime = 3000;
            Line l1 = new Line(new Vector(p.Position.X + p.Scale.X / 2, p.Position.Y + p.Scale.Y / 2), new Vector((p.Velocity.X * 10) + p.Position.X, (p.Velocity.Y * 10) + p.Position.Y), Color.Red);

            //Prefabs.PlayerControlerForce(p, 5);
            if (MouseClick)
            {
                p.Position.X = MousePosition.X;
                p.Position.Y = MousePosition.Y;
                //p.Velocity = new Vector(2, 0);
                LineRenderStack.Clear();
            }
            if (W)
            {
                //g1.Position.X = MousePosition.X;
                //g1.Position.Y = MousePosition.Y;
            }
            if (OncePerClick(Keys.A))
            {
                Room.CurrentRoom = 1;
                Dispose();
                OnLoad();
            }
            if (OncePerClick(Keys.D))
            {
                Room.CurrentRoom = 0;
                Dispose();
                OnLoad();
            }
            //use indevidauls lights and then change surounding objects lights
        }