private IEnumerator Charge() { Attacking = true; CanBeCanceled = false; inv.CanSwap = false; for (currLevel = 0; currLevel < chargeLevels - 1; ++currLevel) { //Debug.Log("Charge Level Equals: " + currLevel); animator.Play(attackName + "Charge", 0, normalInterval * (currLevel + 1)); sfxPlayer.Play(chargeSounds[currLevel]); float time = 0; while (time < chargeTime) { yield return(new WaitForEndOfFrame()); time += Time.deltaTime; } } sfxPlayer.Play(chargeSounds[currLevel]); animator.Play(attackName + "Charge", 0, normalInterval * (currLevel + 1)); // PLACEHOLDER EFFECT float colorInc = 0.05f; while (Attacking) { yield return(new WaitForEndOfFrame()); r.color = new Color(r.color.r, r.color.g + colorInc >= 1 ? 0 : r.color.g + colorInc, r.color.b + colorInc >= 1 ? 0 : r.color.b + colorInc); } }
private void OnTriggerEnter2D(Collider2D collision) { //Debug.Log("Object in waterfall"); if (active && hurtPlayer && (collision.gameObject.tag == "Player" || collision.gameObject.tag == "Prey")) { //Debug.Log("Damaging player-friendly target with electric field"); //characterData = collision.gameObject.GetComponent<CharacterData>(); characterList.Add(collision.gameObject.GetComponent <CharacterData>()); inAOE = true; StopCoroutine(ExecuteAfterSeconds()); DamageOverTime(); Instantiate(sparkTemplate, collision.gameObject.transform.position, Quaternion.identity); shockSFXPlayer.Play(shockSFX); } else if (active && hurtDrones && collision.gameObject.tag == "Predator") { //Debug.Log("Damaging valid target with electric field"); //characterData = collision.gameObject.GetComponent<CharacterData>(); characterList.Add(collision.gameObject.GetComponent <CharacterData>()); inAOE = true; StopCoroutine(ExecuteAfterSeconds()); DamageOverTime(); Instantiate(sparkTemplate, collision.gameObject.transform.position, Quaternion.identity); shockSFXPlayer.Play(shockSFX); } }
/// <summary> /// Add ingredients to active skewer /// </summary> public void AddToSkewer(IngredientData ingredient) { //Do not allow adding more ingredients if full or already cooked if (!ActiveSkewerCooked() && !ActiveSkewerFull()) { quiver[activeSkewer].PushIngredient(ingredient); //UpdateSkewerVisual(); UpdateUI(); } else if (ActiveSkewerFull()) { sfxPlayer.Play(fullSFX); } }
public override void OnTriggerEnter2D(Collider2D collision) { sfxPlayer = GetComponent <PlaySFX>(); // skewer roots if (collision.gameObject.tag == "ThrowThrough") { var environment = collision.gameObject.GetComponent <DestructableEnvironment>(); if (environment != null) { if (environment.skewerable) { environment.health -= 1; environment.Destroy(); } } } // pickup drops if (collision.gameObject.tag == "SkewerableObject") { if (!inventory.ActiveSkewerFull() && !inventory.ActiveSkewerCooked()) { //Debug.Log("Hit skewerable object"); SkewerableObject targetObject = collision.gameObject.GetComponent <SkewerableObject>(); sfxPlayer.Play(pickUpSFX); inventory.AddToSkewer(targetObject.data); MGSTextSpawner.instance?.SpawnText(targetObject.data, transform.position); Destroy(collision.gameObject); } else { sfxPlayer.Play(cantPickUpSFX); } } //do knockback effects if (collision.gameObject.tag == "Predator" || collision.gameObject.tag == "Prey") { DoKnockBack(collision.gameObject.GetComponent <Rigidbody2D>(), bunceForce); } }
private void OnTriggerEnter2D(Collider2D collision) { //Debug.Log("Triggering Event: " + name); if (collision.tag == "Respawn") { Debug.Log("Setting Spawn Point to: " + collision.name); currSpawn = collision.GetComponent <SpawnPoint>(); //only heal if it's needed if (data.health < data.maxHealth) { data.health = data.maxHealth; sfxPlayer.Play(healSFX); } } }
public override bool DoDamage(int damage) { bool dead = false; CameraController.instance.Shake(0.01f, 0.02f, 0.1f); if (damage > 0) { if (Invincible) { return(false); } health -= damage; //only play damage SFX if it was not a killing blow so sounds don't overlap if (health > 0) { var deathSoundObj = Instantiate(sfxPlayer, transform.position, transform.rotation); altSFXPlayer.Play(damageSFX); //play low hp warning if you're at low health if (health == lowHealthThreshhold) { altSFXPlayer.Play(lowHealthSFX); } Invincible = true; StartCoroutine(IFrames(damage * timeConst)); } else if (!res.Respawning) { dead = true; var deathSoundObj = Instantiate(sfxPlayer, transform.position, transform.rotation); altSFXPlayer.Play(deathSFX); res.Respawn(); } } return(dead); }