private void OnElapseShape(object sender, ElapsedEventArgs e) { timer.Enabled = false; if (basic != true) { monster.Move(MoveToPoint); } }
private void Form1_Click(object sender, EventArgs e) { coords = this.PointToClient(Cursor.Position); UpdateText(); if (monster != null) { monster.Move(coords); } Invalidate(); }
// Calls from behaviour public void Move(Vector3 positionSelf) { Vector3 dir = target - positionSelf; Vector3 toMove = dir.normalized * speed * Time.deltaTime; float len = dir.magnitude; if (len != 0) { if (len < toMove.magnitude) { monsterController.Move(dir); } else { monsterController.Move(toMove); } } if (Vector3.Distance(positionSelf, target) <= tooClose) { GetNextWaypoint(); } }