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

        Clear();

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

        RespawnWoman();
        Randomizer();

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

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

        if (Exercise.Progress == ExerciseProgress.Succeeded || Exercise.Progress == ExerciseProgress.Failed)
        {
            BulletLines.ForceActive();
            OnFinish();
        }
    }
Ejemplo 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);
            }
        }
    }
Ejemplo 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();
        }
    }
Ejemplo 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);
    }
Ejemplo n.º 8
0
 /// <summary>
 /// Clears the exercise from bullet lines, bullet holes and scenario logs
 /// </summary>
 public void Clear()
 {
     ScenarioLogs.Clear();
     BulletLines.Destroy();
     DeleteBulletHoles();
 }