コード例 #1
0
 private void OnElapseShape(object sender, ElapsedEventArgs e)
 {
     timer.Enabled = false;
     if (basic != true)
     {
         monster.Move(MoveToPoint);
     }
 }
コード例 #2
0
 private void Form1_Click(object sender, EventArgs e)
 {
     coords = this.PointToClient(Cursor.Position);
     UpdateText();
     if (monster != null)
     {
         monster.Move(coords);
     }
     Invalidate();
 }
コード例 #3
0
    // 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();
        }
    }