Exemple #1
0
    private void Update()
    {
        if (weaponed)
        {
            //銃の先からの方向を計算
            Vector3    direction = this.transform.forward;
            RaycastHit hit;
            Ray        ray = new Ray(transform.position + transform.forward, this.transform.forward);
            if (Physics.Raycast(ray, out hit, warpDistance, Physics.AllLayers, QueryTriggerInteraction.Ignore))
            {
                pointer.VisibleChange(true);
                pointer.PositionChange(hit.point);

                if (warpTime > warpInterval)
                {
                    pointer.AlphaChange(200);
                    if (Input.GetMouseButtonDown(0))
                    {
                        pointer.AlphaChange(0.1f);
                        playerCS.GunWarp(hit.point);
                        warpTime = 0;
                    }
                }
            }
            else
            {
                pointer.VisibleChange(false);
            }
        }
        warpTime += Time.deltaTime;
    }