Example #1
0
        void Start()
        {
            this.InitMessenger("ShipInput");
            this.Human = ShipController.GetHuman();

            if (this.Buttons.Length > 0)
            {
                this.Buttons[0].onButtonDown.AddListener(this.OnButtonDown);
                this.Buttons[0].onButtonUp.AddListener(this.OnButtonUp);
            }
        }
Example #2
0
        public static void SetupTargetables()
        {
            ShipController human = ShipController.GetHuman();
            HudController  hud   = HudController.Instance;

            if ((hud != null) && (human != null))
            {
                for (int i = 0; i < ShipController.Ships.Count; i++)
                {
                    ShipController ship = ShipController.Ships[i];
                    if (FactionController.Instance.IsHostile(human.Faction, ship.Faction))
                    {
                        hud.CreateTargetable(ship);
                    }
                }
            }
        }
Example #3
0
        // Update is called once per frame
        void Update()
        {
            ShipController human = ShipController.GetHuman();

            if ((human == null) || (human.Reticle == null))
            {
                return;
            }

            for (int i = 0; i < this.Targets.Count; i++)
            {
                SpriteObjectTracker sprite = this.Targets[i];
                if (sprite.gameObject.activeInHierarchy && (sprite.target != null))
                {
                    sprite.viewPosition = human.gameObject;
                    ShipController ship = sprite.target.gameObject.GetComponent <ShipController>();
                    if (ship.IsDead())
                    {
                        sprite.gameObject.SetActive(false);
                    }
                }
            }
        }