Esempio n. 1
0
    public void Init(EconomicSystemModel ecoSysModel, EcoPlayerGroupData data, GameObject ecoPlayerPrefab)
    {
        this.ecoSysModel     = ecoSysModel;
        this.ecoPlayerPrefab = ecoPlayerPrefab;
        groupData            = data;
        ecoPlayerModels      = new EcoPlayerModel[groupData.playersCnt];
        ecoPlayerModelsDic   = new Dictionary <int, EcoPlayerModel>();

        for (int i = 0; i < groupData.playersCnt; i++)
        {
            EcoPlayerData ecoPlayerData = groupData.GetPlayerDataById(groupData.startId + i);
            GameObject    model         = GameObject.Instantiate(ecoPlayerPrefab);
            model.name                  = "id " + ecoPlayerData.id + " Eco Player";
            model.transform.parent      = transform;
            model.transform.position    = ecoPlayerData.localPos;
            model.transform.eulerAngles = Vector3.zero;
            EcoPlayerModel ecoModel = model.GetComponent <EcoPlayerModel>();
            ecoModel.Init(ecoPlayerData);
            ecoPlayerModels[i] = ecoModel;
            ecoPlayerModelsDic[ecoPlayerData.id] = ecoModel;
        }

        playersCnt = groupData.playersCnt;
        groupData.onDataAwayChange += DataAwayChange;
    }
    public EcoPlayerData(int id, EcoPlayerData clone)
    {
        this.id  = id;
        isAway   = false;
        isActive = true;

        achievability = 50.0f;

        roleLevel      = 1;
        roleExp        = 0;
        roleAbility    = 1;
        equipmentLevel = 0;
        appearance     = 0;

        targetId  = 0;
        localPos  = Vector2.zero;
        moveSpeed = 1.0f;

        tired           = clone.tired;
        recoverTiredFac = clone.recoverTiredFac;
        money           = clone.money;
        realMoney       = clone.realMoney;
        greed           = clone.greed;
        realGreed       = clone.realGreed;
        vanity          = clone.vanity;
        chanllenge      = clone.chanllenge;
        constancy       = clone.constancy;
        freshness       = clone.freshness;
    }
Esempio n. 3
0
    public int AddGroupData(EcoPlayerData proto, int cnt)
    {
        int groupId = GroupIdBase + groupIdCounter * GroupIdPlus;
        int startId = groupId + 1;
        EcoPlayerGroupData group = new EcoPlayerGroupData(groupId, proto, cnt, startId);

        _groupsDicById[groupId] = group;
        groupIdCounter++;
        return(groupId);
    }
    void Init()
    {
        economicSystemUI = gameObject.AddComponent <EconomicSystemUI>();
        ecoSysData       = new EconomicSystemData();

        EcoPlayerData tempPlayer = new EcoPlayerData(-1, 10000, 10000, 50, 50, 50, 50, 50, 50, 100, 1);

        ecoSysData.AddGroupData(tempPlayer, 30);

        ecoSysData.AddPlaceData(TargetPlaceType.City);

        ecoSysLogic = new EconomicSystemLogic(ecoSysData);
        ecoSysModel = gameObject.AddComponent <EconomicSystemModel>();
        ecoSysModel.Init(ecoSysData, placePrefab, groupPrefab, ecoPlayerPrefab);
    }
    // constructor
    public EcoPlayerGroupData(int groupId, EcoPlayerData proto, int cnt, int startId)
    {
        this.groupId  = groupId;
        protoGroup    = new EcoPlayerData(-1, proto);
        playersCnt    = cnt;
        ecoPlayers    = new EcoPlayerData[cnt];
        ecoPlayersDic = new Dictionary <int, EcoPlayerData>();
        this.startId  = startId;

        for (int i = 0; i < playersCnt; i++)
        {
            ecoPlayers[i] = new EcoPlayerData(startId, protoGroup);
            ecoPlayersDic[ecoPlayers[i].id] = ecoPlayers[i];
            startId++;
        }
    }
 public EcoPlayerLogic(EconomicSystemLogic ecoSysLogic, EcoPlayerGroupLogic groupLogic, EcoPlayerGroupData groupData, EcoPlayerData data)
 {
     this.ecoSysLogic = ecoSysLogic;
     this.groupLogic  = groupLogic;
     this.groupData   = groupData;
     this.data        = data;
     targetPos        = data.localPos;
 }
Esempio n. 7
0
 public void Init(EcoPlayerData data)
 {
     this.data = data;
 }