public void ShowHitChance()
        {
            CharacterComponent player = _playerControl.CharacterComponent;

            if (!CanShowHud())
            {
                _huds.Cleanup();
                return;
            }

            PlayerHUD_Proxy playerHud = new PlayerHUD_Proxy(Game.World.HUD);

            Node movementTarget = playerHud.FindMovementTargetNode();

            HashSet <String> remainingHuds = _huds.GetKnownHudNames();

            using (PinnedCharacterPosition.Hack(player, movementTarget))
            {
                foreach (VisibleTargetHud visible in EnumerateVisibleEnemyHuds(player))
                {
                    if (!visible.TryGetAimInfo(_playerControl, out String aimInfo))
                    {
                        continue;
                    }

                    TargetHitHud hud = _huds.ProvideHud(playerHud, visible.Character);
                    hud.Refresh(visible.ScreenPoint, aimInfo);
                    remainingHuds.Remove(hud.Name);
                }
            }

            remainingHuds.Do(_huds.DisableHud);
        }
Esempio n. 2
0
        private GameObject ProvideHudLayer(PlayerHUD_Proxy playerHud)
        {
            String layerName = MakeHudName("Root");

            GameObject rootObject = GameObject.Find(layerName);

            if (rootObject == null)
            {
                rootObject = new GameObject(layerName);
                rootObject.transform.SetParent(playerHud.Bth.transform.parent.transform);
            }

            return(rootObject);
        }
Esempio n. 3
0
        private TargetHitHud CreateHud(PlayerHUD_Proxy playerHud, String hudName)
        {
            GameObject template = playerHud.Bth;

            GameObject hudLayer  = ProvideHudLayer(playerHud);
            GameObject hudObject = GameObject.Instantiate(template);

            hudObject.name = hudName;
            hudObject.transform.SetParent(hudLayer.transform, false);

            _hudObjects.Add(hudName);

            return(new TargetHitHud(hudObject));
        }
Esempio n. 4
0
        public TargetHitHud ProvideHud(PlayerHUD_Proxy playerHud, CharacterComponent cc)
        {
            Int32  instanceId = cc.GetInstanceID();
            String hudName    = MakeHudName(instanceId);

            GameObject hudObject = GameObject.Find(hudName);

            if (hudObject != null)
            {
                return(new TargetHitHud(hudObject));
            }

            return(CreateHud(playerHud, hudName));
        }