Beispiel #1
0
        void OnDestroy()
        {
            Damageable.onDamageableDied -= UnitDiedAction;

            if (isHovered)
            {
                Cursors.SetDefaultCursor();
            }
        }
Beispiel #2
0
        public void OnMouseEnter()
        {
            isHovered = true;

            if (unitHoveredEvent != null)
            {
                unitHoveredEvent.Invoke(this);
            }

            if (Selection.selectedUnits.Count == 0 || !Selection.selectedUnits[0])
            {
                return;
            }

            var mainUnit = Selection.selectedUnits[0];

            if (!IsInMyTeam(Player.GetLocalPlayer().teamIndex) && mainUnit.data.hasAttackModule)
            {
                var fowModule = GetModule <FogOfWarModule>();

                if (!fowModule || fowModule.isVisibleInFOW)
                {
                    Cursors.SetAttackCursor();
                }
            }

            if (IsInMyTeam(Player.GetLocalPlayer().teamIndex) && mainUnit.data.isHarvester && data.isRefinery)
            {
                Cursors.SetGiveResourcesCursor();
            }

            if (data.canCarryUnitsCount > 0 && IsInMyTeam(Player.GetLocalPlayer().teamIndex))
            {
                bool anyCanBeCarried = false;

                for (int i = 0; i < Selection.selectedUnits.Count; i++)
                {
                    if (Selection.selectedUnits[i] && Selection.selectedUnits[i].data.canBeCarried)
                    {
                        anyCanBeCarried = true;
                        break;
                    }
                }

                if (anyCanBeCarried)
                {
                    var carryModule = GetModule <CarryModule>();

                    if (carryModule && carryModule.CanCarryOneMoreUnit())
                    {
                        Cursors.SetGiveResourcesCursor();
                    }
                }
            }
        }
Beispiel #3
0
        public void OnMouseExit()
        {
            isHovered = false;

            if (unitUnhoveredEvent != null)
            {
                unitUnhoveredEvent.Invoke(this);
            }

            Cursors.SetDefaultCursor();
        }
        public void OnMouseEnter()
        {
            if (Selection.selectedUnits.Count == 0 || !Selection.selectedUnits[0].data.isHarvester)
            {
                return;
            }

            var selectedHarvester    = Selection.selectedUnits[0].GetModule <Harvester>();
            var needResourcesCursour = selectedHarvester.harvestedResources < selectedHarvester.MaxResources;

            if (needResourcesCursour)
            {
                Cursors.SetResourcesCursor();
            }
            else
            {
                Cursors.SetRestrictCursor();
            }
        }
 public void OnMouseExit()
 {
     Cursors.SetDefaultCursor();
 }
 public void ReturnToLobby()
 {
     Cursors.SetDefaultCursor();
     SceneManager.LoadScene("Lobby");
 }