Beispiel #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            PlayerStaminaScript ps = other.GetComponent <PlayerStaminaScript>();
            if (!ps.regainStamina)
            {
                Debug.Log("taking stamina damage");
                ps.staminaDrain(staminaDamage);
            }

            else
            {
                HealthScript h = other.GetComponent <HealthScript>() ?? other.GetComponentInParent <HealthScript>();
                if (h != null)
                {
                    h.takeDamage(cutDamage, bluntDamage);
                }
            }
        }
        else if (other.CompareTag("Enemy Target"))
        {
            HealthScript h = other.GetComponent <HealthScript>() ?? other.GetComponentInParent <HealthScript>();
            if (h != null)
            {
                h.takeDamage(cutDamage, bluntDamage);
            }
        }
    }
Beispiel #2
0
 void Awake()
 {
     #region Get Components
     playerMovement  = GetComponent <PlayerMovement>();
     playerRoot      = transform.GetChild(0);
     playerFootsteps = GetComponentInChildren <PlayerFootsteps>();
     playerStamina   = GetComponent <PlayerStaminaScript>();
     weaponManager   = GetComponent <WeaponManager>();
     #endregion
 }
Beispiel #3
0
    void Awake()
    {
        stam = GetComponent <PlayerStaminaScript>();
        hs   = GetComponent <HealthScript>();

        rb   = GetComponent <Rigidbody2D>();
        anim = GetComponentInChildren <Animator>();

        anim.SetBool("IsDead", false);

        canUsePower = false;
        hasPower    = false;
        isDead      = false;
    }
    // Use this for initialization
    private void Start()
    {
        isDead     = false;
        rb2d       = GetComponent <Rigidbody2D>();
        myAnimator = GetComponent <Animator>();
        myFeet     = this.gameObject.transform.GetChild(2).gameObject.GetComponent <BoxCollider2D>();
        Debug.Log("haha" + myFeet);

        pickupList = this.gameObject.transform.GetChild(1).gameObject;
        carrotGun  = this.gameObject.transform.GetChild(0).gameObject;

        playerHealth  = gameObject.GetComponent <PlayerHealthController>();
        playerStamina = gameObject.GetComponent <PlayerStaminaScript>();

        carrotAmmoController = carrotGun.GetComponent <CarrotAmmoController>();
        //PickupRecipeScript = pickupList.GetComponent<PickupRecipeScript>();
    }
    void Awake()
    {
        #region Get Components
        weaponManager = GetComponent <WeaponManager>();

        zoomCameraAnimator = transform.Find("Root").transform.Find("FPS Camera").GetComponent <Animator>();

        mainCameraAnimator = transform.Find("Root").transform.Find("Main Camera").GetComponent <Animator>();

        playerStamina = GetComponent <PlayerStaminaScript>();


        playerMovement = GetComponent <PlayerMovement>();

        playerHealth = GetComponent <PlayerHealthScript>();

        ammoCount = weaponManager.getAmmoCount();

        isReloadingWeapon = weaponManager.getReloadState();

        footStepsOfThePlayer = GetComponent <PlayerFootsteps>();
        #endregion
    }