Exemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log("enter into a trigger");
        if (collision.gameObject.CompareTag("Human_base"))
        {
            Debug.Log("enter into a human base trigger");
            base_ressource = collision.gameObject.GetComponent <Ressource_manager>();
            base_Manager   = collision.gameObject.GetComponent <Base_manager>();

            int temp_divine_sponge = ship_ressource.get_divine_sponge();
            ship_ressource.remove_divine_sponge(temp_divine_sponge);
            base_ressource.add_divine_sponge(temp_divine_sponge);

            base_Manager.display_option();
            base_Manager.update_ui();

            inside_human_base = true;
        }
        else if (collision.gameObject.CompareTag("Divine_sponge_ressource"))
        {
            // Debug.Log("hamecon contre éponge !");
            ressource_recolte = collision.gameObject;
            inside_divine_sponge_ressource = true;
        }
    }
Exemplo n.º 2
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Jellyman_base"))
        {
            Base_manager base_Manager = collision.gameObject.GetComponent <Base_manager>();
            base_Manager.remove_option();

            inside_jellyman_base = false;
        }
        else if (collision.gameObject.CompareTag("Divine_sponge_ressource"))
        {
            inside_divine_sponge_ressource = false;
        }
    }
Exemplo n.º 3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        //Debug.Log("enter into a trigger");
        if (collision.gameObject.CompareTag("Jellyman_base"))
        {
            //Debug.Log("enter into a jelly base trigger");
            base_ressource = collision.gameObject.GetComponent <Ressource_manager>();
            base_Manager   = collision.gameObject.GetComponent <Base_manager>();

            int temp_divine_sponge = this.fish_ressource.get_divine_sponge();
            fish_ressource.remove_divine_sponge(temp_divine_sponge);
            base_ressource.add_divine_sponge(temp_divine_sponge);

            base_Manager.display_option();
            base_Manager.update_ui();

            inside_jellyman_base = true;
        }
        else if (collision.gameObject.CompareTag("Divine_sponge_ressource"))
        {
            ressource_recolte = collision.gameObject;
            inside_divine_sponge_ressource = true;
        }
    }
Exemplo n.º 4
0
 private void Start()
 {
     human_base    = GameObject.FindWithTag("Human_base").GetComponent <Base_manager>();
     jellyman_base = GameObject.FindWithTag("Jellyman_base").GetComponent <Base_manager>();
 }
Exemplo n.º 5
0
 private void projectile_contact(string gameObject_type, string object_collision, Collision2D collision, Base_manager base_manager)
 {
     if (gameObject.tag == gameObject_type)
     {
         if (collision.gameObject.tag == object_collision)
         {
             transform.parent = collision.transform;
             GetComponent <Rigidbody2D>().velocity    = Vector2.zero;
             GetComponent <Rigidbody2D>().isKinematic = true;
             Debug.Log(base_manager.tag);
             base_manager.damage();
         }
     }
 }