Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (dwarf1.Fusionning && dwarf2.Fusionning && !fusioned)
        {
            fusioned = true;
            dwarf1.Fusion();
            dwarf2.Fusion();
        }
        else if (dwarf1.Fusionning && !fusioned && climber == null)
        {
            climber = dwarf1;
            Debug.Log("climber = dwarf1");
        }
        else if (dwarf2.Fusionning && !fusioned && climber == null)
        {
            climber = dwarf2;
            Debug.Log("climber = dwarf2");
        }
        else if (!dwarf1.Fusionning && !dwarf2.Fusionning && climber != null)
        {
            climber = null;
            Debug.Log("climber = null");
        }

        if (fusioned && (!dwarf1.Fusionning || !dwarf2.Fusionning) && !joined)
        {
            fusioned = false;
            dwarf1.StopFusion();
            dwarf2.StopFusion();
            Debug.Log("stopFusion");
        }
    }