public new void Move(MovementWay way) { if (_Catched) { return; } _Movement = way; OnPaint(new System.Windows.Forms.PaintEventArgs(this.CreateGraphics(), this.ClientRectangle)); if (!IsBlock()) { switch (way) { case MovementWay.Up: this.Location = new System.Drawing.Point(this.Location.X, this.Location.Y - Speed); break; case MovementWay.Down: this.Location = new System.Drawing.Point(this.Location.X, this.Location.Y + Speed); break; case MovementWay.Left: this.Location = new System.Drawing.Point(this.Location.X - Speed, this.Location.Y); break; case MovementWay.Right: this.Location = new System.Drawing.Point(this.Location.X + Speed, this.Location.Y); break; } } Pacman_Movement?.Invoke(this, this.Location); }
// Start is called before the first frame update void Start() { grafoMapa = new Grafo(); pacman = GameObject.Find("Pacman"); blinky = GameObject.Find("Blinky"); pacmanScript = pacman.GetComponent <Pacman_Movement>(); //Lê as comidas foreach (Transform child in transform) { //Cria o vérticeComida Vertice auxiliarComida = new Vertice(child.transform.position.x, child.transform.position.y); //Adicionar o vérticeComida no GrafoMapa grafoMapa.vertices.Add(auxiliarComida); } grafoMapa.fillArestas(); }
public new void Move(MovementWay way) { if (_Catched) { return; } _Movement = way; OnPaint(new PaintEventArgs(CreateGraphics(), ClientRectangle)); if (!IsBlock()) { switch (way) { case MovementWay.Up: Location = new Point(Location.X, Location.Y - Speed); break; case MovementWay.Down: Location = new Point(Location.X, Location.Y + Speed); break; case MovementWay.Left: Location = new Point(Location.X - Speed, Location.Y); break; case MovementWay.Right: Location = new Point(Location.X + Speed, Location.Y); break; } } if (_Dots != null) { Pacman_Movement(this, Location); return; } Pacman_Movement?.Invoke(this, Location); }
public Pacman(ref Dots[] dots) : this() { _Dots = dots; Pacman_Movement += new Pacman_Movement(Pacman_Pacman_Movement); }