Beispiel #1
0
    void OnPointerDown(ScreenJoystick joystick)
    {
        Debug.Log("OnPointerDown");
        _lastHighlightSite = null;
        SortNearbySites();
        var allBunkerList = BattleEngine.Instance.BunkerList;

        foreach (var bunker in allBunkerList)
        {
            bunker.Gizmo.HideAndDehighlightAllSiteButtons();
        }
        for (int i = 0; i < SortedCount; i++)
        {
            var e = SortArray[i];
            allBunkerList[e.BunkerIndex].Gizmo.ShowHideSiteButton(e.SiteIndex, true);
        }
    }
Beispiel #2
0
    void OnPointerStay(ScreenJoystick joystick)
    {
        if (joystick.IsValidDrag)
        {
            //肯定已经SortNearbySites()过了。当然如果在移动中,可能需要重新计算
            var index = PickupSelectedSite(joystick.WorldActualDisplacement);
            if (index >= 0)
            {
                var site = SortArray[index].GetBunkerSite(BattleEngine.Instance.BunkerList);
                if (site != _lastHighlightSite)
                {
                    var allBunkerList = BattleEngine.Instance.BunkerList;
                    for (int i = 0; i < SortedCount; i++)
                    {
                        var e = SortArray[i];
                        allBunkerList[e.BunkerIndex].Gizmo.HighlightAllSiteButtons(false);
                    }

                    _lastHighlightSite = site;
                    var gizmo = site.Bunker.Gizmo;
                    gizmo.HighlightSiteButton(site.ID, true);
                }
            }
        }
        else
        {
            if (_lastHighlightSite)
            {
                var allBunkerList = BattleEngine.Instance.BunkerList;
                for (int i = 0; i < SortedCount; i++)
                {
                    var e = SortArray[i];
                    allBunkerList[e.BunkerIndex].Gizmo.HighlightAllSiteButtons(false);
                }
                _lastHighlightSite = null;
            }
        }
    }
Beispiel #3
0
    void UpdateMove()
    {
        if (!localPlayerAuthority)
        {
            return;
        }
        if (CurrentBunkerSite && Vector3.Distance(Position, CurrentBunkerSite.Position) > 0.5f)
        {
            CurrentBunkerSite.OnUnitExit(this);
            CurrentBunkerSite = null;
        }
        if (DestinationBunkerSite && Vector3.Distance(Position, DestinationBunkerSite.Position) <= 0.5f)
        {
            CurrentBunkerSite = DestinationBunkerSite;
            DestinationBunkerSite.OnUnitEnter(this);
            DestinationBunkerSite = null;

            if (UnitController.Instance.FocusedUnit == this)
            {
                UnitController.Instance.OnFocusedUnitEnterBunker();
            }
        }
    }
    void OnPointerStay(ScreenJoystick joystick)
    {
        if (joystick.IsValidDrag)
        {
            //肯定已经SortNearbySites()过了。当然如果在移动中,可能需要重新计算
            var index = PickupSelectedSite(joystick.WorldActualDisplacement);
            if (index >= 0)
            {
                var site = SortArray[index].GetBunkerSite(BattleEngine.Instance.BunkerList);
                if (site != _lastHighlightSite)
                {
                    var allBunkerList = BattleEngine.Instance.BunkerList;
                    for (int i = 0; i < SortedCount; i++)
                    {
                        var e = SortArray[i];
                        allBunkerList[e.BunkerIndex].Gizmo.HighlightAllSiteButtons(false);
                    }

                    _lastHighlightSite = site;
                    var gizmo = site.Bunker.Gizmo;
                    gizmo.HighlightSiteButton(site.ID, true);
                }
            }
        }
        else
        {
            if (_lastHighlightSite)
            {
                var allBunkerList = BattleEngine.Instance.BunkerList;
                for (int i = 0; i < SortedCount; i++)
                {
                    var e = SortArray[i];
                    allBunkerList[e.BunkerIndex].Gizmo.HighlightAllSiteButtons(false);
                }
                _lastHighlightSite = null;
            }
        }
    }
 void OnPointerDown(ScreenJoystick joystick)
 {
     Debug.Log("OnPointerDown");
     _lastHighlightSite = null;
     SortNearbySites();
     var allBunkerList = BattleEngine.Instance.BunkerList;
     foreach (var bunker in allBunkerList)
     {
         bunker.Gizmo.HideAndDehighlightAllSiteButtons();
     }
     for (int i = 0; i < SortedCount; i++)
     {
         var e = SortArray[i];
         allBunkerList[e.BunkerIndex].Gizmo.ShowHideSiteButton(e.SiteIndex, true);
     }
 }
Beispiel #6
0
 public void SetDestination(BunkerSite destinationBunkerSite)
 {
     DestinationBunkerSite = destinationBunkerSite;
     Walker.WalkTo(destinationBunkerSite.Position);
 }
Beispiel #7
0
    void UpdateMove()
    {
        if (!localPlayerAuthority) return;
        if (CurrentBunkerSite && Vector3.Distance(Position, CurrentBunkerSite.Position) > 0.5f)
        {
            CurrentBunkerSite.OnUnitExit(this);
            CurrentBunkerSite = null;
        }
        if (DestinationBunkerSite && Vector3.Distance(Position, DestinationBunkerSite.Position) <= 0.5f)
        {
            CurrentBunkerSite = DestinationBunkerSite;
            DestinationBunkerSite.OnUnitEnter(this);
            DestinationBunkerSite = null;

            if (UnitController.Instance.FocusedUnit == this)
            {
                UnitController.Instance.OnFocusedUnitEnterBunker();
            }
        }
    }
Beispiel #8
0
 public void SetDestination(BunkerSite destinationBunkerSite)
 {
     DestinationBunkerSite = destinationBunkerSite;
     Walker.WalkTo(destinationBunkerSite.Position);
 }