コード例 #1
0
ファイル: Gathering.cs プロジェクト: zoompower/Hivemind
    public void SetData(MindData mindData)
    {
        GatheringData data = mindData as GatheringData;

        carryingObjects   = new List <GameObject>();
        gatheredResources = new List <string>();
        inventory         = new Dictionary <ResourceType, int>();
        for (int i = 0; i < data.InventoryKeys.Count; i++)
        {
            inventory[data.InventoryKeys[i]] = data.InventoryValues[i];
        }
        IsScout            = data.IsScout;
        nextHarvest        = data.NextHarvest;
        preparingReturn    = data.PreparingReturn;
        scouting           = data.Scouting;
        busy               = data.Busy;
        leavingBase        = data.LeavingBase;
        state              = data.State;
        nextState          = data.NextState;
        prefferedType      = data.PrefferedType;
        carryWeight        = data.CarryWeight;
        prefferedDirection = data.PrefferedDirection;
        enterBase          = data.EnterBase;
        if (data.AntGuid != "")
        {
            Initiate(GameWorld.Instance.FindAnt(Guid.Parse(data.AntGuid)));
            foreach (string guid in data.GatheredResources)
            {
                carryResource(GameWorld.Instance.FindResourceNode(Guid.Parse(guid)));
            }
            ant.UpdateSpeed();
            ant.StopAllCoroutines();
            if (scouting)
            {
                ant.StartCoroutine(Scout(data.ScoutSeconds, new Vector3(data.ScoutDestinationX, data.ScoutDestinationY, data.ScoutDestinationZ)));
            }
            if (preparingReturn)
            {
                ant.StartCoroutine(ReturnToBase(data.ReturnSeconds));
            }
            if (data.TargetGuid != "")
            {
                target = GameWorld.Instance.FindResourceNode(Guid.Parse(data.TargetGuid));
                ant.GetAgent().SetDestination(target.GetPosition());
            }
            if (leavingBase)
            {
                ant.StartCoroutine(ExitBase(nextState));
            }
            else if (enterBase || state == State.MovingToStorage)
            {
                ant.StartCoroutine(EnterBase(ant.GetBaseController().GetPosition()));
            }
        }
    }
コード例 #2
0
ファイル: CombatMind.cs プロジェクト: zoompower/Hivemind
    public void SetData(MindData mindData)
    {
        CombatData data = mindData as CombatData;

        minEstimatedDifference = data.MinEstimatedDifference;
        prefferedHealth        = data.PrefferedHealth;
        if (data.AntGuid != "")
        {
            ant = GameWorld.Instance.FindAnt(Guid.Parse(data.AntGuid));
        }
        busy = data.Busy;
    }
コード例 #3
0
ファイル: BaseGroupMind.cs プロジェクト: zoompower/Hivemind
    public void SetData(MindData mindData)
    {
        BaseGroupMindData data = mindData as BaseGroupMindData;

        waiting = data.Waiting;
        if (data.AntGuid != "")
        {
            ant = GameWorld.Instance.FindAnt(Guid.Parse(data.AntGuid));
            if (waiting && data.WaitTimer > 0f)
            {
                ant.StartCoroutine(Wait(data.WaitTimer));
            }
        }
    }