void Update() { var playerHealth = player.GetComponent <HealthSystem>().healthAsPercentage; if (playerHealth <= Mathf.Epsilon) { StopAllCoroutines(); return; } distanceToPlayer = Vector3.Distance(player.transform.position, transform.position); WeaponSystem weaponSystem = GetComponent <WeaponSystem>(); currentWeaponRange = weaponSystem.CurrectWeaponConfig.MaxAttackRange; if (distanceToPlayer > chaseRadius && state != State.patrolling) { StopAllCoroutines(); weaponSystem.StopAttacking(); StartCoroutine(Patrol); } if (distanceToPlayer <= chaseRadius && state != State.chasing) { StopAllCoroutines(); weaponSystem.StopAttacking(); StartCoroutine(ChasePlayer); } if (distanceToPlayer <= currentWeaponRange && state != State.attacking) { StopAllCoroutines(); state = State.attacking; weaponSystem.AttackTarget(player.gameObject); } }
public override void Use(GameObject target) { PlayAbilitySound(); PlayParticalEffect(); var playerHealth = player.GetComponent <HealthSystem>(); playerHealth.Heal((config as SelfHealConfig).GetHealingPoints()); PlayAbilityAnimation(); }
public override void Use(GameObject target) { PlayAnimation(); var playerHealth = player.GetComponent <HealthSystem>(); PayParticleEffect(); PlayAudio(); playerHealth.Heal(((SelfHealCongif)Config).ExtraHealth); }
private void OnTriggerEnter() { PlayerControl player = FindObjectOfType <PlayerControl>(); WeaponSystem weapon = player.GetComponent <WeaponSystem>(); weapon.PutWeaponInHand(weaponConfig); var audioSource = GetComponent <AudioSource>(); audioSource.PlayOneShot(pickUpSFX); GetComponent <CapsuleCollider>().enabled = false; //Destroy(gameObject); }
// Update is called once per frame void Update() { float xValue = -(player.GetComponent <SpecialAbilities>().energyAsPercentage / 2f) - 0.5f; energyBarRawImage.uvRect = new Rect(xValue, 0f, 0.5f, 1f); }
private void HealPlayer(GameObject target) { var playerHealth = player.GetComponent <HealthSystem>(); playerHealth.Heal((specialAbilty as SelfHeal).GetHealValue()); }