Example #1
0
 public void ChangeBaitSetting(Tag baitSetting)
 {
     if (fetchChore != null)
     {
         fetchChore.Cancel("SwitchedResource");
     }
     if (baitSetting != activeBaitSetting)
     {
         activeBaitSetting = baitSetting;
         baitStorage.DropAll(false, false, default(Vector3), true);
     }
     base.smi.GoTo(base.smi.sm.idle);
     baitStorage.storageFilters = new List <Tag>
     {
         activeBaitSetting
     };
     if (baitSetting != Tag.Invalid)
     {
         GetComponent <KSelectable>().RemoveStatusItem(Db.Get().BuildingStatusItems.NoLureElementSelected, false);
         if (base.smi.master.baitStorage.IsEmpty())
         {
             CreateFetchChore();
         }
     }
     else
     {
         GetComponent <KSelectable>().AddStatusItem(Db.Get().BuildingStatusItems.NoLureElementSelected, null);
     }
 }
Example #2
0
 public void CancelActiveRequest()
 {
     if (fetchChore != null)
     {
         MaterialNeeds.Instance.UpdateNeed(requestedEntityTag, -1f);
         fetchChore.Cancel("User canceled");
         fetchChore = null;
     }
     requestedEntityTag = Tag.Invalid;
     UpdateStatusItem();
     SetPreview(Tag.Invalid, false);
 }
 public void CancelChore()
 {
     if (chore != null)
     {
         chore.Cancel("Storage Changed");
         chore = null;
     }
 }
 public void CancelChore()
 {
     if (chore == null)
     {
         return;
     }
     chore.Cancel("Storage Changed");
     chore = null;
 }
Example #5
0
 public void Cancel(string reason)
 {
     while (Chores.Count > 0)
     {
         FetchChore fetchChore = Chores[0];
         fetchChore.Cancel(reason);
         Chores.Remove(fetchChore);
     }
 }
Example #6
0
    private void OnFetchChoreEnd(Chore chore)
    {
        FetchChore fetchChore = (FetchChore)chore;

        if (Chores.Contains(fetchChore))
        {
            UnfetchedAmount += fetchChore.amount;
            fetchChore.Cancel("FetchChore Redistribution");
            Chores.Remove(fetchChore);
            IssueTask();
        }
    }
    public void QueuePlacement(int target)
    {
        targetCell = target;
        Vector3 position = Grid.CellToPosCBC(targetCell, Grid.SceneLayer.Front);

        if ((UnityEngine.Object)preview == (UnityEngine.Object)null)
        {
            preview = GameUtil.KInstantiate(Assets.GetPrefab(previewTag), position, Grid.SceneLayer.Front, null, 0);
            preview.SetActive(true);
        }
        else
        {
            preview.transform.SetPosition(position);
        }
        if (chore != null)
        {
            chore.Cancel("new target");
        }
        chore = new FetchChore(Db.Get().ChoreTypes.Fetch, preview.GetComponent <Storage>(), 1f, new Tag[1]
        {
            new Tag(prefabId.InstanceID.ToString())
        }, null, null, null, true, OnChoreComplete, null, null, FetchOrder2.OperationalRequirement.None, 0);
    }
 public void CancelFetchTask()
 {
     chore.Cancel("Exit State");
     chore = null;
 }