Esempio n. 1
0
    public void Restart()
    {
        BulletLines.SetActive(Settings.DrawLines);

        Clear();

        States[CurrentState].Restart();
    }
Esempio n. 2
0
    public override void Restart()
    {
        base.Restart();

        RespawnWoman();
        Randomizer();

        BulletLines.SetActive(Exercise.Settings.DrawLines);
    }
Esempio n. 3
0
    private void OnSettingsChanged()
    {
        BulletLines.SetActive(Settings.DrawLines);

        ApplyGunRotation[] guns = GameObject.Find("[CameraRig]").GetComponentsInChildren <ApplyGunRotation>();
        foreach (ApplyGunRotation gun in guns)
        {
            gun.Apply();
        }
    }
Esempio n. 4
0
    public void OnProgressChanged()
    {
        Exercise.whiteboard.CheckProgress();

        if (Exercise.Progress == ExerciseProgress.Succeeded || Exercise.Progress == ExerciseProgress.Failed)
        {
            BulletLines.ForceActive();
            OnFinish();
        }
    }
Esempio n. 5
0
    /// <summary>
    /// Checks the collison with the bullet ray and handles them
    /// </summary>
    private void DetectHit()
    {
        bool hasHit = Physics.Raycast(barrelExit.transform.position, transform.rotation * Vector3.forward, out RaycastHit hit);

        if (hasHit)
        {
            if (!hit.collider.gameObject.GetComponent <Enemy>())
            {
                SpawnBulletHole(hit);
            }

            IHitable target = hit.transform.GetComponentInParent <IHitable>();
            if (target == null)
            {
                if (drawLines)
                {
                    BulletLines.SpawnLine(BulletLine, barrelExit.transform.position, barrelExit.transform.position + transform.rotation * Vector3.forward * 10, Color.red);
                }
                return;
            }

            HitType type = target.OnHit(this, hit);

            if (drawLines)
            {
                Color linecolor = Color.red;
                switch (type)
                {
                case HitType.MISS:
                    linecolor = Color.red;
                    break;

                case HitType.RIGHT:
                    linecolor = Color.green;
                    break;

                case HitType.UNWANTED:
                    linecolor = Color.magenta;
                    break;
                }
                BulletLines.SpawnLine(BulletLine, barrelExit.transform.position, barrelExit.transform.position + transform.rotation * Vector3.forward * 10, linecolor);
            }
        }
        else
        {
            if (drawLines)
            {
                BulletLines.SpawnLine(BulletLine, barrelExit.transform.position, barrelExit.transform.position + transform.rotation * Vector3.forward * 10, Color.red);
            }
        }
    }
Esempio n. 6
0
    public void Start()
    {
        BulletLines.SetActive(Settings.DrawLines);
        Settings.SettingsChanged += OnSettingsChanged;

        foreach (ExcersiseState state in States)
        {
            state.gameObject.SetActive(false);
        }

        States[CurrentState].OnInitialize();

        if (Settings.UseNormalGuns)
        {
            GameObject.Find("Toggle Controller").GetComponent <GazeButtonToggle>().Activate();
        }
    }
Esempio n. 7
0
    public virtual void OnStart()
    {
        if (leftGun)
        {
            leftGun.Reload();
        }
        if (rightGun)
        {
            rightGun.Reload();
        }

        StartTime = Time.realtimeSinceStartup;
        BulletLines.SetActive(Exercise.Settings.DrawLines);
        Exercise.Progress = ExerciseProgress.Started;
        Exercise.StartButton.SetState(false);
        Exercise.RestartButton.SetState(true);
    }
Esempio n. 8
0
 /// <summary>
 /// Clears the exercise from bullet lines, bullet holes and scenario logs
 /// </summary>
 public void Clear()
 {
     ScenarioLogs.Clear();
     BulletLines.Destroy();
     DeleteBulletHoles();
 }