コード例 #1
0
 public bool CanReach(IApproachable approachable)
 {
     if ((bool)navigator)
     {
         return(navigator.CanReach(approachable));
     }
     if (consumerState.hasSolidTransferArm)
     {
         int cell = approachable.GetCell();
         return(consumerState.solidTransferArm.IsCellReachable(cell));
     }
     return(false);
 }
コード例 #2
0
 public bool IsWithinReach(IApproachable approachable)
 {
     if ((bool)navigator)
     {
         if ((UnityEngine.Object) this == (UnityEngine.Object)null || (UnityEngine.Object)base.gameObject == (UnityEngine.Object)null)
         {
             return(false);
         }
         return(Grid.IsCellOffsetOf(Grid.PosToCell(this), approachable.GetCell(), approachable.GetOffsets()));
     }
     if (consumerState.hasSolidTransferArm)
     {
         return(consumerState.solidTransferArm.IsCellReachable(approachable.GetCell()));
     }
     return(false);
 }
コード例 #3
0
    public int GetNavigationCost(Navigator navigator)
    {
        int           num       = -1;
        int           cell      = Grid.PosToCell(this);
        IApproachable component = GetComponent <IApproachable>();

        CellOffset[] array = (component != null) ? component.GetOffsets() : new CellOffset[1]
        {
            default(CellOffset)
        };
        CellOffset[] array2 = array;
        foreach (CellOffset offset in array2)
        {
            int cell2          = Grid.OffsetCell(cell, offset);
            int navigationCost = navigator.GetNavigationCost(cell2);
            if (navigationCost != -1 && (num == -1 || navigationCost < num))
            {
                num = navigationCost;
            }
        }
        return(num);
    }
コード例 #4
0
 public bool GetNavigationCost(IApproachable approachable, out int cost)
 {
     if ((bool)navigator)
     {
         cost = navigator.GetNavigationCost(approachable);
         if (cost != -1)
         {
             return(true);
         }
     }
     else if (consumerState.hasSolidTransferArm)
     {
         int cell = approachable.GetCell();
         if (consumerState.solidTransferArm.IsCellReachable(cell))
         {
             cost = Grid.GetCellRange(this.NaturalBuildingCell(), cell);
             return(true);
         }
     }
     cost = 0;
     return(false);
 }
コード例 #5
0
    public void OnTargetMoved(object data)
    {
        int num = Grid.PosToCell(base.smi.master.gameObject);

        if ((UnityEngine.Object)base.smi.sm.attackTarget.Get(base.smi) == (UnityEngine.Object)null)
        {
            CleanUpMultitool();
        }
        else
        {
            if (base.smi.GetCurrentState() == base.smi.sm.attack)
            {
                int           num2      = Grid.PosToCell(base.smi.sm.attackTarget.Get(base.smi).gameObject);
                CellOffset[]  array     = null;
                IApproachable component = base.smi.sm.attackTarget.Get(base.smi).gameObject.GetComponent <IApproachable>();
                if (component != null)
                {
                    array = component.GetOffsets();
                    if (num == num2 || !Grid.IsCellOffsetOf(num, num2, array))
                    {
                        if (multiTool != null)
                        {
                            CleanUpMultitool();
                        }
                        base.smi.GoTo(base.smi.sm.approachtarget);
                    }
                }
                else
                {
                    Debug.Log("has no approachable");
                }
            }
            if (multiTool != null)
            {
                multiTool.UpdateHitEffectTarget();
            }
        }
    }
コード例 #6
0
 public int GetNavigationCost(IApproachable approachable)
 {
     return(GetNavigationCost(approachable.GetCell(), approachable.GetOffsets()));
 }
コード例 #7
0
 public bool CanReach(IApproachable approachable)
 {
     return(CanReach(approachable.GetCell(), approachable.GetOffsets()));
 }