Ejemplo n.º 1
0
    /// <summary>
    /// 反射レーザーを生成
    /// </summary>
    private void Reflected()
    {
        GameObject go = Instantiate(reflectedLaserPrefab);

        go.transform.parent = transform.parent;
        reflectedLaser      = go.GetComponent <EraseLaser>();
    }
Ejemplo n.º 2
0
    protected override void Awake()
    {
        base.Awake();

        // 子としてeraseLaserを持ってるはず
        eraseLaser = GetComponentInChildren <EraseLaser>();

        if (eraseLaser == null)
        {
            Debug.Log("Raygunを子として持つ必要があります");
        }

        // 初期動作
        if (playOnAwake)
        {
            isIrradiation = true;
        }
        else
        {
            isIrradiation = false;
        }
    }
Ejemplo n.º 3
0
    protected override void Awake()
    {
        base.Awake();

        // 子としてeraseLaserを持ってるはず
        eraseLaser = GetComponentInChildren<EraseLaser>();

        if (eraseLaser == null)
        {
            Debug.Log("Raygunを子として持つ必要があります");
        }

        // 初期動作
        if (playOnAwake)
        {
            isIrradiation = true;
        }
        else
        {
            isIrradiation = false;
        }
    }
Ejemplo n.º 4
0
    protected override void Update()
    {
        if (FadeManager.instance.IsFading)
        {
            return;
        }

        Cursor.lockState = CursorLockMode.Locked;

        Move(); // プレイヤーの移動など

        float mouseX = Input.GetAxis("Mouse X");
        float mouseY = Input.GetAxis("Mouse Y");

        CameraMove(-mouseY, mouseX); // カメラの操作

        Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f));

        #if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.B))
        {
            RaycastHit hit;
            Physics.Raycast(ray, out hit);
            Instantiate(explosionPrefab, hit.point, Quaternion.identity);
        }
        #endif

        // レイガンを照射
        if (Input.GetMouseButton(0) && isLaserPossible && !AdvancedWriteMessageSingleton.instance.isWrite && lasers[0].isPossible)
        {
            if (eraseLaser == null)
            {
                eraseLaser = ((GameObject)Instantiate(redLightPrefab, lightPosition.transform.position, Quaternion.identity)).GetComponent<EraseLaser>();
                eraseLaser.transform.parent = Camera.main.transform;
                eraseLaser.color = lasers[currentLaserIndex].color;

                if (examine.grabbedObject != null)
                {
                    examine.LetGo();
                }

                //SoundPlayerSingleton.instance.PlaySE(gameObject, soundCollector[SoundCollector.SoundName.LaserLow], true, true, 1f, 0.0f, true);
            }

            eraseLaser.IrradiationToTarget(ray.direction * 100.0f + transform.position);
        }

        // レーザーを停止
        if (!Input.GetMouseButton(0) && eraseLaser != null)
        {
            StopLaser();
        }

        bool isLaserCange = false;
        if (Input.GetMouseButton(0) && Input.GetMouseButtonDown(1))
        {
            isLaserCange = true;
        }

        if (Input.GetMouseButtonDown(1) && !isRightClick)
        {
            isRightClick = true;
        }
        else if (Input.GetMouseButtonDown(1) && isRightClick)
        {
            isLaserCange = true;
            isRightClick = false;
            rightClickWindowTimeCount = 0.0f;
        }

        if (isRightClick && rightClickWindowTimeCount < rightClickWindowTime)
        {
            rightClickWindowTimeCount += Time.deltaTime;
        }
        else if (isRightClick)
        {
            rightClickWindowTimeCount = 0.0f;
            isRightClick = false;
        }

        if (Input.GetKeyDown(KeyCode.Q) && lasers[currentLaserIndex].isPossible)
        {
            isLaserCange = true;
        }

        if (isLaserCange)
        {
            ChangeLaser();

            if (eraseLaser != null)
            {
                eraseLaser.color = lasers[currentLaserIndex].color;
            }
        }

        if (rayGunIconControllers == null)
        {
            return;
        }

        foreach (MovableObjectController movableObjectController in rayGunIconControllers)
        {
            if (movableObjectController.currentState == MovableObjectController.State.Move)
            {
                return;
            }
        }

        if (rollCount > 0)
        {
            rollCount--;
            foreach (MovableObjectController movableObjectController in rayGunIconControllers)
            {
                movableObjectController.Action();
            }
        }
    }
Ejemplo n.º 5
0
 /// <summary>
 /// 反射レーザーを生成
 /// </summary>
 private void Reflected()
 {
     GameObject go = Instantiate(reflectedLaserPrefab);
     go.transform.parent = transform.parent;
     reflectedLaser = go.GetComponent<EraseLaser>();
 }
Ejemplo n.º 6
0
    protected override void Update()
    {
        if (FadeManager.instance.IsFading)
        {
            return;
        }

        Cursor.lockState = CursorLockMode.Locked;

        Move();         // プレイヤーの移動など

        float mouseX = Input.GetAxis("Mouse X");
        float mouseY = Input.GetAxis("Mouse Y");

        CameraMove(-mouseY, mouseX);         // カメラの操作

        Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f));

#if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.B))
        {
            RaycastHit hit;
            Physics.Raycast(ray, out hit);
            Instantiate(explosionPrefab, hit.point, Quaternion.identity);
        }
#endif

        // レイガンを照射
        if (Input.GetMouseButton(0) && isLaserPossible && !AdvancedWriteMessageSingleton.instance.isWrite && lasers[0].isPossible)
        {
            if (eraseLaser == null)
            {
                eraseLaser = ((GameObject)Instantiate(redLightPrefab, lightPosition.transform.position, Quaternion.identity)).GetComponent <EraseLaser>();
                eraseLaser.transform.parent = Camera.main.transform;
                eraseLaser.color            = lasers[currentLaserIndex].color;

                if (examine.grabbedObject != null)
                {
                    examine.LetGo();
                }

                //SoundPlayerSingleton.instance.PlaySE(gameObject, soundCollector[SoundCollector.SoundName.LaserLow], true, true, 1f, 0.0f, true);
            }

            eraseLaser.IrradiationToTarget(ray.direction * 100.0f + transform.position);
        }

        // レーザーを停止
        if (!Input.GetMouseButton(0) && eraseLaser != null)
        {
            StopLaser();
        }

        bool isLaserCange = false;
        if (Input.GetMouseButton(0) && Input.GetMouseButtonDown(1))
        {
            isLaserCange = true;
        }

        if (Input.GetMouseButtonDown(1) && !isRightClick)
        {
            isRightClick = true;
        }
        else if (Input.GetMouseButtonDown(1) && isRightClick)
        {
            isLaserCange = true;
            isRightClick = false;
            rightClickWindowTimeCount = 0.0f;
        }

        if (isRightClick && rightClickWindowTimeCount < rightClickWindowTime)
        {
            rightClickWindowTimeCount += Time.deltaTime;
        }
        else if (isRightClick)
        {
            rightClickWindowTimeCount = 0.0f;
            isRightClick = false;
        }

        if (Input.GetKeyDown(KeyCode.Q) && lasers[currentLaserIndex].isPossible)
        {
            isLaserCange = true;
        }

        if (isLaserCange)
        {
            ChangeLaser();

            if (eraseLaser != null)
            {
                eraseLaser.color = lasers[currentLaserIndex].color;
            }
        }

        if (rayGunIconControllers == null)
        {
            return;
        }

        foreach (MovableObjectController movableObjectController in rayGunIconControllers)
        {
            if (movableObjectController.currentState == MovableObjectController.State.Move)
            {
                return;
            }
        }

        if (rollCount > 0)
        {
            rollCount--;
            foreach (MovableObjectController movableObjectController in rayGunIconControllers)
            {
                movableObjectController.Action();
            }
        }
    }