Exemplo n.º 1
0
    public void EnableTurretsAtDay()
    {
        //On active les tourelles le jour
        foreach (GameObject GOturret in turretsInScene)
        {
            MonoBehaviour[] scripts = GOturret.GetComponent <TurretActivation>().scriptsToActivate;
            for (int i = 0; i < scripts.Length; i++)
            {
                if (GOturret.GetComponent <TurretActivation>().linkedNode.isPoweredByGenerator)
                {
                    scripts[i].enabled = true;
                }
                else
                {
                    scripts[i].enabled = false;
                }
            }
        }



        //On désactive la spotlight le jour
        foreach (GameObject GObuilding in buildingsInScene)
        {
            GObuilding.GetComponent <TurretActivation>().DisableScriptsAtDayIfSpotlight();
        }
    }
Exemplo n.º 2
0
    public void DisableTurretsAtNight()
    {
        //On désactive les tourelles la nuit
        foreach (GameObject GOturret in turretsInScene)
        {
            if (!GOturret.GetComponent <Unit_Stats>().canSeeDuringNight || !GOturret.GetComponent <TurretActivation>().linkedNode.isAffectedBySpotlight)
            {
                MonoBehaviour[] scripts = GOturret.GetComponent <TurretActivation>().scriptsToActivate;
                for (int i = 0; i < scripts.Length; i++)
                {
                    scripts[i].enabled = false;
                }
            }
        }


        //On active la spotlight la nuit
        foreach (GameObject GObuilding in buildingsInScene)
        {
            GObuilding.GetComponent <TurretActivation>().EnableScriptsAtNightIfSpotlight();
        }
    }
Exemplo n.º 3
0
    public void RemoveBuilding(GameObject building)
    {
        //buildingsInScene.RemoveAt(building.GetComponent<UnitIndex>().indexInUnitManager);
        buildingsInScene.Remove(building);

        foreach (GameObject GObuilding in buildingsInScene)
        {
            if (GObuilding != null)
            {
                GObuilding.GetComponent <UnitIndex>().indexInUnitManager = buildingsInScene.IndexOf(GObuilding);
            }
        }

        if (building.GetComponent <Unit_Stats>().isGenerator)
        {
            building.GetComponent <Generator_IA>().RevertNodeState();
        }
        else if (building.GetComponent <Unit_Stats>().isSpotlight)
        {
            building.GetComponent <Spotlight_IA>().RevertNodeState();
        }
    }