Exemplo n.º 1
0
    private void displayResourceInfo(WorldResources.Type resourceType, int tolerance)
    {
        int amount;

        amount = Mathf.FloorToInt(_resourcesPlacer.Amount(resourceType));
        if (amount <= tolerance)
        {
            if (amount > 0)
            {
                events.DisplayResourceIsLow(resourceType);
            }
            else
            {
                events.DisplayResourceDepleted(resourceType);
            }
        }
    }
Exemplo n.º 2
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();
        _selection = GetComponent<Managers.SelectionManager>();
        //request the race of the player
        _selfRace = info.GetPlayerRace();
        _selection.SetRace(race);

        cam = GameObject.FindWithTag("MainCamera").GetComponent<CameraController>();
        events = GetComponent<EventsNotifier>();

        Battle.PlayerInformation me = info.GetBattle().GetPlayerInformationList()[playerId - 1];
        InstantiateBuildings(me.GetBuildings());
        InstantiateUnits(me.GetUnits());
        SetInitialResources(me.GetResources().Wood, me.GetResources().Food, me.GetResources().Metal, me.GetResources().Gold);
        // gameObject.AddComponent<ResourcesPlacer>();
        
        missionStatus = new MissionStatus(playerId);
        _resourcesPlacer = ResourcesPlacer.get(this); // initialization

        // TODO Set this values dynamically
        minFoodTolerance = 100;
        minWoodTolerance = 500;
        minMetalTolerance = 500;
        minGoldTolerance = 500;

        foodDepleted = _resourcesPlacer.Amount(WorldResources.Type.FOOD) <= 0;

        ActorSelector selector = new ActorSelector()
        {
            registerCondition = (g) => !(g.GetComponent<FOWEntity>().IsOwnedByPlayer),
            fireCondition = (g) => true
        };
        Utils.Subscriber<FOWEntity.Actions, FOWEntity>.get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);

        timeToShow = WAIT_FOR_FINISH;

    }
Exemplo n.º 3
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();
        _selection = GetComponent <Managers.SelectionManager>();
        //request the race of the player
        _selfRace = info.GetPlayerRace();
        _selection.SetRace(race);

        cam    = GameObject.FindWithTag("MainCamera").GetComponent <CameraController>();
        events = GetComponent <EventsNotifier>();

        Battle.PlayerInformation me = info.GetBattle().GetPlayerInformationList()[playerId - 1];
        InstantiateBuildings(me.GetBuildings());
        InstantiateUnits(me.GetUnits());
        SetInitialResources(me.GetResources().Wood, me.GetResources().Food, me.GetResources().Metal, me.GetResources().Gold);
        // gameObject.AddComponent<ResourcesPlacer>();

        missionStatus    = new MissionStatus(playerId);
        _resourcesPlacer = ResourcesPlacer.get(this); // initialization

        // TODO Set this values dynamically
        minFoodTolerance  = 100;
        minWoodTolerance  = 500;
        minMetalTolerance = 500;
        minGoldTolerance  = 500;

        foodDepleted = _resourcesPlacer.Amount(WorldResources.Type.FOOD) <= 0;

        ActorSelector selector = new ActorSelector()
        {
            registerCondition = (g) => !(g.GetComponent <FOWEntity>().IsOwnedByPlayer),
            fireCondition     = (g) => true
        };

        Utils.Subscriber <FOWEntity.Actions, FOWEntity> .get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);

        timeToShow = WAIT_FOR_FINISH;
    }