Пример #1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.S))
        {
            Spear s = GetSpear();
            if (s != null)
            {
                s.Fire(Launcher.up, 30f);
            }
        }

        if (Move)
        {
            float z = Launcher.localEulerAngles.z;
            Launcher.localEulerAngles += Vector3.forward * Speed * Time.deltaTime * direction;

            if (direction == 1)
            {
                if (z > MaxAngle - 1f && z < 180f)
                {
                    direction = -1;
                }
            }
            else
            {
                if (z < 360 - (MaxAngle - 1f) && z > 180f)
                {
                    direction = 1;
                }
            }
        }
    }