Example #1
0
    private void gather()
    {
        if (inside_divine_sponge_ressource)
        {
            if (Input.GetButtonDown("ButtonA_2"))
            {
                isRecolting_divine_sponge_ressource = true;
            }

            else if (Input.GetButton("ButtonA_2"))
            {
                isRecolting_divine_sponge_ressource = true;
                if (isRecolting_divine_sponge_ressource)
                {
                    compteur += Time.fixedDeltaTime;
                    //Debug.Log("compteur " + compteur);

                    if (compteur < timer_recolte)
                    {
                        //Debug.Log("Récolte Début !");
                    }

                    else if (compteur >= timer_recolte)
                    {
                        //Debug.Log("Récolte Fin !");
                        Ressource_manager temp_ressource_manager  = ressource_recolte.GetComponent <Ressource_manager>();
                        Animator          temp_ressource_animator = ressource_recolte.GetComponent <Animator>();
                        int temp_ressource = temp_ressource_manager.get_divine_sponge();
                        //Debug.Log("there is " + temp_ressource + " divine sponge inside");

                        if (tools_recolte >= temp_ressource)
                        {
                            temp_ressource_manager.remove_divine_sponge(temp_ressource);
                            base_ressource.add_divine_sponge(temp_ressource);
                            temp_ressource_animator.SetTrigger("Gather");
                            base_Manager.update_ui();
                        }

                        else
                        {
                            temp_ressource_manager.remove_divine_sponge(tools_recolte);
                            base_ressource.add_divine_sponge(tools_recolte);
                            temp_ressource_animator.SetTrigger("Gather_not_empty");
                            base_Manager.update_ui();
                        }

                        temp_ressource_manager.get_divine_sponge();
                        isRecolting_divine_sponge_ressource = false;
                    }
                }
            }

            else
            {
                compteur = 0;
                isRecolting_divine_sponge_ressource = false;
            }
        }
    }
Example #2
0
 public void update_unit_2()
 {
     //Debug.Log("in update unit 2");
     if (Base_ressource.get_weapon() >= weapon_value_update_2 &&
         Base_ressource.get_divine_sponge() >= divine_sponge_value_update_2)
     {
         level_unit = Update_level.Update_2;
         Base_ressource.remove_weapon(weapon_value_update_2);
         Base_ressource.remove_divine_sponge(divine_sponge_value_update_2);
         heal();
     }
     update_ui();
 }
Example #3
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;
        }
    }
Example #4
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;
        }
    }