private void OnReachableChanged(object data)
 {
     if ((UnityEngine.Object)childRenderer != (UnityEngine.Object)null)
     {
         Material             material = childRenderer.material;
         bool                 flag     = (bool)data;
         Color                color    = material.color;
         Game.LocationColours dig      = Game.Instance.uiColours.Dig;
         if (!(color == dig.invalidLocation))
         {
             KSelectable component = GetComponent <KSelectable>();
             if (flag)
             {
                 Material             material2 = material;
                 Game.LocationColours dig2      = Game.Instance.uiColours.Dig;
                 material2.color = dig2.validLocation;
                 component.RemoveStatusItem(Db.Get().BuildingStatusItems.MopUnreachable, false);
             }
             else
             {
                 component.AddStatusItem(Db.Get().BuildingStatusItems.MopUnreachable, this);
                 GameScheduler.Instance.Schedule("Locomotion Tutorial", 2f, delegate
                 {
                     Tutorial.Instance.TutorialMessage(Tutorial.TutorialMessages.TM_Locomotion, true);
                 }, null, null);
                 Material             material3 = material;
                 Game.LocationColours dig3      = Game.Instance.uiColours.Dig;
                 material3.color = dig3.unreachable;
             }
         }
     }
 }
    private void OnReachableChanged(object data)
    {
        if ((UnityEngine.Object)childRenderer == (UnityEngine.Object)null)
        {
            childRenderer = GetComponentInChildren <MeshRenderer>();
        }
        Material material = childRenderer.material;

        isReachable = (bool)data;
        Color color = material.color;

        Game.LocationColours dig = Game.Instance.uiColours.Dig;
        if (!(color == dig.invalidLocation))
        {
            UpdateColor(isReachable);
            KSelectable component = GetComponent <KSelectable>();
            if (isReachable)
            {
                component.RemoveStatusItem(Db.Get().BuildingStatusItems.DigUnreachable, false);
            }
            else
            {
                component.AddStatusItem(Db.Get().BuildingStatusItems.DigUnreachable, this);
                GameScheduler.Instance.Schedule("Locomotion Tutorial", 2f, delegate
                {
                    Tutorial.Instance.TutorialMessage(Tutorial.TutorialMessages.TM_Locomotion, true);
                }, null, null);
            }
        }
    }
Пример #3
0
    private void OnReachableChanged(object data)
    {
        KAnimControllerBase component = GetComponent <KAnimControllerBase>();

        if ((bool)data)
        {
            GetComponent <KSelectable>().RemoveStatusItem(Db.Get().BuildingStatusItems.ConstructionUnreachable, false);
            if ((UnityEngine.Object)component != (UnityEngine.Object)null)
            {
                KAnimControllerBase  kAnimControllerBase = component;
                Game.LocationColours build = Game.Instance.uiColours.Build;
                kAnimControllerBase.TintColour = build.validLocation;
            }
        }
        else
        {
            GetComponent <KSelectable>().AddStatusItem(Db.Get().BuildingStatusItems.ConstructionUnreachable, this);
            if ((UnityEngine.Object)component != (UnityEngine.Object)null)
            {
                KAnimControllerBase  kAnimControllerBase2 = component;
                Game.LocationColours build2 = Game.Instance.uiColours.Build;
                kAnimControllerBase2.TintColour = build2.unreachable;
            }
        }
    }
 private void UpdateColor(bool reachable)
 {
     if ((UnityEngine.Object)childRenderer != (UnityEngine.Object)null)
     {
         Material material = childRenderer.material;
         if (RequiresTool(Grid.Element[Grid.PosToCell(base.gameObject)]) || Undiggable(Grid.Element[Grid.PosToCell(base.gameObject)]))
         {
             Material             material2 = material;
             Game.LocationColours dig       = Game.Instance.uiColours.Dig;
             material2.color = dig.invalidLocation;
         }
         else if (Grid.Element[Grid.PosToCell(base.gameObject)].hardness >= 50)
         {
             if (reachable)
             {
                 Material             material3 = material;
                 Game.LocationColours dig2      = Game.Instance.uiColours.Dig;
                 material3.color = dig2.validLocation;
             }
             else
             {
                 Material             material4 = material;
                 Game.LocationColours dig3      = Game.Instance.uiColours.Dig;
                 material4.color = dig3.unreachable;
             }
             multitoolContext      = lasersForHardness[1].first;
             multitoolHitEffectTag = lasersForHardness[1].second;
         }
         else
         {
             if (reachable)
             {
                 Material             material5 = material;
                 Game.LocationColours dig4      = Game.Instance.uiColours.Dig;
                 material5.color = dig4.validLocation;
             }
             else
             {
                 Material             material6 = material;
                 Game.LocationColours dig5      = Game.Instance.uiColours.Dig;
                 material6.color = dig5.unreachable;
             }
             multitoolContext      = lasersForHardness[0].first;
             multitoolHitEffectTag = lasersForHardness[0].second;
         }
     }
 }