Exemple #1
0
    //todo 删除之前的无用代码
    void Update_kill()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0));

            //if(Physics.Raycast(ray, out hit, float.MaxValue, LayerNameToIntMask(playerLayerName)))
            if (Physics.Raycast(ray, out hit, float.MaxValue))
            {
                var ln = LayerMask.LayerToName(hit.transform.gameObject.layer);
                if (!ln.Equals(Consts.PlayerLayerName) || hit.transform.root != this.transform)
                {
                    return;
                }

                playerSelected = true;
                MoveOnFloor();
                trailReference.Clear();
            }
        }
        else if (Input.GetMouseButtonUp(0))
        {
            playerSelected = false;
        }

        if (Input.GetMouseButton(0) && playerSelected)
        {
            MoveOnFloor();
        }
    }
Exemple #2
0
 public void startDraw()
 {
     playerSelected = true;
     if (trailReference != null)
     {
         trailReference.Clear();
         Destroy(trailReference.gameObject);
         trailReference = null;
     }
 }
Exemple #3
0
    void Start()
    {
        SplineTrailRenderer trail = GetComponent <SplineTrailRenderer>();

        trail.Clear();
        trail.spline.Clear();

        foreach (Transform t in pointList)
        {
            trail.spline.knots.Add(new Knot(t.position));
        }

        trail.spline.Parametrize();
    }
Exemple #4
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0));

            if (Physics.Raycast(ray, out hit, float.MaxValue, LayerNameToIntMask(playerLayerName)))
            {
                playerSelected = true;
                MoveOnFloor();
                trailReference.Clear();
            }
        }
        else if (Input.GetMouseButtonUp(0))
        {
            playerSelected = false;
        }

        if (Input.GetMouseButton(0) && playerSelected)
        {
            MoveOnFloor();
        }
    }
Exemple #5
0
 public void CancelMove()
 {
     trailReference.Clear();
 }