Example #1
0
    void Update()
    {
        timer  += Time.deltaTime;
        canFire = timer > firerate;


        GameObject Player = GameObject.Find("Player");
        BoxHP      BoxHP  = Player.GetComponent <BoxHP> ();

        GameObject Pistol   = GameObject.Find("Pistol");
        Shooting   Shooting = Player.GetComponent <Shooting> ();

        if (BoxHP.currenthp <= 0)
        {
            Shooting.secondary.SetActive(false);
            Shooting.primary.SetActive(true);
            currentWeapon             = Shooting.primary.GetComponent <BaseWeapon> ();
            currentWeapon.currentAmmo = 15;             //currentWeapon.maxAmmo;
            canFire = false;
            Debug.Log(canFire + " " + reloading + " " + currentAmmo + currentWeapon);
            Shooting.secondary.SetActive(false);
            Shooting.primary.SetActive(true);
            canFire = true;
            currentWeapon.currentAmmo = 15;
        }

        if (currentWeapon = Shooting.primary.GetComponent <BaseWeapon> ())
        {
            canFire = true;
            Shooting.secondary.SetActive(false);
        }
    }
Example #2
0
    public void SetHealthText()
    {
        GameObject Player = GameObject.Find("Player");
        BoxHP      BoxHP  = Player.GetComponent <BoxHP> ();

        healthtext.text = "HP: " + BoxHP.currenthp.ToString() + "/" + BoxHP.maxhp.ToString();

        healthslider.value = BoxHP.currenthp;
    }
Example #3
0
    public void KnifeCheckHits()
    {
        Vector3 forward = transform.TransformDirection(Vector3.forward) * 10;

        boxihp = GameObject.Find("Enemy").GetComponent <BoxHP>();
        if (Physics.Raycast(transform.position, forward, 7, LayerMask.GetMask("Player")))
        {
            print("Stab!");
            boxihp.TakeDamage(15);
        }
    }
Example #4
0
 // Use this for initialization
 void Start()
 {
     AS     = this.GetComponent <AudioSource>();
     SR     = this.GetComponent <SpriteRenderer>();
     RB     = GetComponentInParent <Rigidbody2D>();
     BoxHP  = GetComponentInParent <BoxHP>();
     Player = GameObject.Find("Player");
     _Motor = Player.GetComponent <PlatformerMotor2D>();
     if (SceneManager.GetActiveScene().name == "Tutorial")
     {
         _Motor.frozen = false;
         Freeze        = false;
     }
     else
     {
         StartCoroutine(StageStart());
     }
     //StartCoroutine(Ani());
 }
Example #5
0
    public override void Fire(Vector3 origin, Vector3 direction)
    {
        base.Fire(origin, direction);

        if (canFire == true)
        {
            Vector3 forward = transform.parent.parent.TransformDirection(Vector3.forward) * 10;

            if (Physics.Raycast(transform.position, forward, 7, LayerMask.GetMask("Player")))
            {
                boxihp = GameObject.Find("Enemy").GetComponent <BoxHP>();
            }
            {
                boxihp.StabDamage();
                Debug.Log("Stab!");
            }
            timer = 0;
        }
    }
Example #6
0
 // Use this for initialization
 void Start()
 {
     boxHP = GameObject.Find("Box").GetComponent <BoxHP>();
 }
Example #7
0
 // Use this for initialization
 void Start()
 {
     Player = GameObject.Find("Player");
     BoxHP  = Player.GetComponent <BoxHP>();
     Rain.gameObject.SetActive(false);
 }