Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        accessSoul = GameObject.FindWithTag("SoulHolder").GetComponent <SoulHolder>();
        soulCount  = accessSoul.souls;



        if (Input.GetKeyDown(KeyCode.O))
        {
            Debug.Log(startRange);
            Debug.Log(startRate);
        }

        if (target == null)
        {
            return;
        }

        //Target Lock-On
        Vector3    dir          = target.position - transform.position;
        Quaternion lookRotation = Quaternion.LookRotation(dir);
        Vector3    rotation     = Quaternion.Lerp(partToRotate.rotation, lookRotation, Time.deltaTime * turnSpeed).eulerAngles;

        partToRotate.rotation = Quaternion.Euler(0f, rotation.y, 0f);


        if (fireCountdown <= 0f)
        {
            Shoot();
            fireCountdown = 1f / fireRate;
        }

        fireCountdown -= Time.deltaTime;
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        accessSouls = GameObject.FindWithTag("SoulHolder").GetComponent <SoulHolder>();

        currentHealth = startHealth;

        repairText.text = ("");
    }
Esempio n. 3
0
    public void ResetSoulCount()
    {
        SoulHolder soul = GameObject.FindWithTag("SoulHolder").GetComponent <SoulHolder>();

        soul.ResetSoulCount();

        Debug.Log("Souls Reset");
    }
Esempio n. 4
0
    public void MainMenuButton()
    {
        SceneManager.LoadScene("Start Menu");

        SoulHolder soul = GameObject.FindWithTag("SoulHolder").GetComponent <SoulHolder>();

        soul.ResetSoulCount();

        Debug.Log("Souls Reset");
    }
Esempio n. 5
0
    public void RestartTheGame()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);

        SoulHolder soul = GameObject.FindWithTag("SoulHolder").GetComponent <SoulHolder>();

        soul.ResetSoulCount();

        Debug.Log("Souls Reset");
    }
Esempio n. 6
0
    // Update is called once per frame
    void Update()
    {
        if ((currentAmmo == 0) && (backupAmmo == 0))
        {
            reloadAnim.enabled = !reloadAnim.enabled;
        }

        accessSoul = GameObject.FindWithTag("SoulHolder").GetComponent <SoulHolder>();
        soulCount  = accessSoul.souls;
        timer     += Time.deltaTime;

        if (Input.GetKeyDown(KeyCode.L))
        {
            Destroy(GameObject.FindWithTag("Enemy"));
        }



        if ((currentAmmo == 0) && (backupAmmo != 0) && (!isReloading))
        {
            StartCoroutine(reload());

            audioSource.PlayOneShot(reloading, 0.1f);
        }



        if (Input.GetButtonDown("Fire1") && timer > fireRate && currentAmmo > 0 && !isReloading)
        {
            StartCoroutine(Fire());
            timer = 0;
            audioSource.PlayOneShot(shoot, 0.1f);
        }


        if ((Input.GetKeyDown(KeyCode.R)) && (backupAmmo > 0) && (currentAmmo < 5))
        {
            StartCoroutine(reload());
            audioSource.PlayOneShot(reloading, 0.1f);
        }

        currAmmo.text = "Ammo: " + currentAmmo.ToString() + " / " + backupAmmo.ToString();

        if (backupAmmo == startBackupAmmo)
        {
            AmmoButton.SetActive(false);
        }
        else
        {
            AmmoButton.SetActive(true);
        }
    }
Esempio n. 7
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }

        else
        {
            Destroy(gameObject);
        }
    }
Esempio n. 8
0
    // Update is called once per frame
    void Update()
    {
        accessSoul = GameObject.FindWithTag("SoulHolder").GetComponent <SoulHolder>();
        soulCount  = accessSoul.souls;

        if (clickCount == 5)
        {
            upgradeButton.SetActive(false);

            rangeUpgrade.text  = "Maxed";
            rateUpgrade.text   = "Maxed";
            damageUpgrade.text = "Maxed";
            healthUpgrade.text = "Maxed";

            levelText.color = Color.green;

            Debug.Log("Fully Upgraded");
        }
    }
Esempio n. 9
0
    // Update is called once per frame
    void Update()
    {
        accessSoul = GameObject.FindWithTag("SoulHolder").GetComponent <SoulHolder>();
        soulCount  = accessSoul.souls;
        backupAmmo = ammoCount.backupAmmo;

        if (soulCount >= 1000 && !isLearnt)
        {
            tasTurretEnabled = true;
        }

        if (soulCount >= 500 && backupAmmo <= 0 && !isLearnt)
        {
            tasAmmoEnabled = true;
        }

        if (Input.GetKeyDown(KeyCode.Return))
        {
            isLearnt         = true;
            tasTurretEnabled = false;
            tasAmmoEnabled   = false;
        }
    }
Esempio n. 10
0
 void Update()
 {
     accessSoul = GameObject.FindWithTag("SoulHolder").GetComponent <SoulHolder>();
     soulCount  = accessSoul.souls;
 }