コード例 #1
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);
                    }
                }
            }
        }
コード例 #2
0
 protected override bool OnConditionsMet(GameObject triggerer)
 {
     for (int i = 0; i < this.Ships.Length; i++)
     {
         ShipController ship = this.Ships[i];
         if ((ship != null) && (ship.gameObject == triggerer))
         {
             SplineGroup currentGroup = ship.GetSplineGroup();
             if ((this.From == null) || (currentGroup == null) || (this.From == currentGroup))
             {
                 if (currentGroup != this.To)
                 {
                     ship.SetSplineGroup(this.To);
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #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);
                    }
                }
            }
        }
コード例 #4
0
        public void CreateHud(ShipController humanShip, GameObject lookAt)
        {
            this.ReticleObj.SetActive(true);
            ShipReticle reticle = this.ReticleObj.GetComponent <ShipReticle>();

            reticle.SetPosition(Vector3.zero);
            reticle.lookAt    = lookAt;
            humanShip.Reticle = reticle;

            if (this.JoyStick != null)
            {
                this.JoyStick.SetActive(true);
            }

            if (this.Throttle != null)
            {
                this.Throttle.SetActive(true);
            }

            for (var i = 0; i < this.Buttons.Length; i++)
            {
                this.Buttons[i].SetActive(true);
            }
        }