public void FinishSting(int enemyDamage, GameObject target, bool autoKill = false) { EnemyBehaviour targetEB = target.GetComponent <EnemyBehaviour>(); targetEB.ApplyDamage(-Math.Abs(enemyDamage)); if (autoKill) { targetEB.EnemyDefeated(); } }
// This can be more fleshed out in future iterations of our game public void FinishSting(int score, int maxScore, GameObject target) { LevelManager lm = FindObjectOfType <LevelManager>(); EnemyBehaviour targetEB = target.GetComponent <EnemyBehaviour>(); if (targetEB == null) { targetEB = target.GetComponentInParent <EnemyBehaviour>(); } stinging = false; // killing the wasps can definitely be improved upon if (score > maxScore * .9) { Debug.Log("Option1"); lm.IncrementHealth(-minDamage); targetEB.EnemyDefeated(); } else if (score > maxScore * .6) { Debug.Log("Option2"); lm.IncrementHealth(-averageDamage); targetEB.EnemyDefeated(); } else if (score > maxScore * .4) { Debug.Log("Option3"); lm.IncrementHealth(-maxDamage); targetEB.EnemyDefeated(); } else { Debug.Log("Option4"); lm.IncrementHealth(-maxDamage); } stingIndicator.SetActive(false); RearviewCameraBehaviour.RequestRearviewOff(); FindObjectOfType <PlayerControl>().StartBuzzSFX(); }