Exemple #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     {
         IAttackable attackable = collision.GetComponent <IAttackable>();
         if (attackable != null)
         {
             attackable.Be_Attacked();
         }
     }
 }
 // Start is called before the first frame update
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (Is_Enabled)
     {
         IAttackable attackable = collision.GetComponent <IAttackable>();
         if (attackable != null && collision.tag == "Player")
         {
             attackable.Be_Attacked();
         }
     }
 }
Exemple #3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        IAttackable enemy = collision.GetComponent <IAttackable>();

        if (enemy != null)
        {
            enemy.Be_Attacked();
        }
        //Instantiate(Impact, transform);
        Destroy(gameObject);
    }
    private void Attack()
    {
        RaycastHit2D Raycast_Info = Physics2D.Raycast(transform.position, transform.right, 50, Lazer_Mask);

        if (Raycast_Info.collider != null)
        {
            IAttackable enemy = Raycast_Info.collider.GetComponent <IAttackable>();
            if (enemy != null)
            {
                // Change Lazer Lenght
                Lazer_Line.SetPosition(1, new Vector3(Raycast_Info.distance, 0, 0));
                enemy.Be_Attacked();
            }
            Lazer_Line.colorGradient = Gradiant_Attack;
        }
    }
Exemple #5
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        //Debug.Log("Explosion " + Time.time);
        IAttackable enemy = collision.GetComponent <IAttackable>();

        if (enemy != null)
        {
            enemy.Be_Attacked();
        }
        TNT_An.SetTrigger("Explode");
        // Stop the TNT
        TNT_RB.velocity = new Vector2(0, 0);


        StartCoroutine(Explode());
    }
    private IEnumerator Attack_Sequence(IAttackable attackable)
    {
        // Stop other coroutine exectution
        Is_Enabled = false;
        // Check used only to prevent crash when coroutine called frome Launch death animation
        if (attackable != null)
        {
            attackable.Be_Attacked();
        }
        // Launch animation
        Mini_Slime_An.Launch_Death_Animation();
        // Stop the mob from moving
        Mini_Slime_Mo.Set_Life(false);
        // Wait for the animation to finish
        yield return(new WaitForSeconds(0.5f));

        // Destroy entire game object by calling the finction in a parent script
        Mini_Slime_He.Destroy();
    }