コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        flightComputer        = PlaneGameObject.GetComponent <FlightComputer>();
        navigationComputer    = PlaneGameObject.GetComponent <NavigationComputer>();
        mediaWindowController = gameObject.GetComponent <MediaWindowController>();
        soundController       = transform.parent.GetComponentInChildren <SoundController>();

        DestinationMenuAnimator  = GameObject.Find("Destination_Select_UI").GetComponent <Animator>();
        FlightSelectMenuAnimator = GameObject.Find("Flight_Select_UI").GetComponent <Animator>();
        MediaMenuAnimator        = GameObject.Find("Media_UI").GetComponent <Animator>();

        //Create menu groups
        FlightSelectUi      = GameObject.Find("Flight_Select_UI").GetComponent <CanvasGroup>();
        DestinationSelectUi = GameObject.Find("Destination_Select_UI").GetComponent <CanvasGroup>();
        MediaMenuUi         = GameObject.Find("Media_UI").GetComponent <CanvasGroup>();

        //Retrieve elements
        destination1Text = GameObject.Find("destination1_button").GetComponentInChildren <Text>();
        destination2Text = GameObject.Find("destination2_button").GetComponentInChildren <Text>();
        destination3Text = GameObject.Find("destination3_button").GetComponentInChildren <Text>();
        destination4Text = GameObject.Find("destination4_button").GetComponentInChildren <Text>();

        destination1Button = GameObject.Find("destination1_button").GetComponentInChildren <CanvasGroup>();
        destination2Button = GameObject.Find("destination2_button").GetComponentInChildren <CanvasGroup>();
        destination3Button = GameObject.Find("destination3_button").GetComponentInChildren <CanvasGroup>();
        destination4Button = GameObject.Find("destination4_button").GetComponentInChildren <CanvasGroup>();

        FlightSelectMenuAnimator.SetBool("IsFlightSelectOpen", false);
        OpenDestinationSelect();
    }
コード例 #2
0
 // Start is called before the first frame update
 void Start()
 {
     plane                = transform;
     engineController     = gameObject.GetComponent <EngineController>();
     flightDataVisualizer = gameObject.GetComponentInChildren <FlightDataVisualizer>();
     controllerInputs     = GameObject.Find("VRActions").GetComponent <ControllerInputs>();
     pathNavigator        = this.GetComponent <PathNavigator>();
     navigationComputer   = this.GetComponent <NavigationComputer>();
     currentFlightData    = new FlightData(plane, engineController, pathNavigator);
     flightDataVisualizer.CurrentFlightData = currentFlightData;
     soundController = GetComponentInChildren <SoundController>();
     soundController.FlightComputerRef = this;
 }
コード例 #3
0
ファイル: TradeHelper.cs プロジェクト: martongyiran/Andromeda
        public static async Task <int> CannonRange()
        {
            try
            {
                var ship = await NavigationComputer.GetSpaceshipStatusAsync();

                return(ship.CannonCount * 10);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);

                throw e;
            }
        }
コード例 #4
0
ファイル: TradeHelper.cs プロジェクト: martongyiran/Andromeda
        private static async Task <int> EquipementSpace()
        {
            try
            {
                var ship = await NavigationComputer.GetSpaceshipStatusAsync();

                return((ship.CannonCount + ship.DriveCount + ship.SensorCount + ship.ShieldCount) * 20);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);

                throw e;
            }
        }
コード例 #5
0
ファイル: TradeHelper.cs プロジェクト: martongyiran/Andromeda
        public static async Task <int> AvailableCargoSpace()
        {
            try
            {
                var ship = await NavigationComputer.GetSpaceshipStatusAsync();

                return(ship.TotalCapacity - await EquipementSpace());
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);

                throw e;
            }
        }
コード例 #6
0
ファイル: TradeHelper.cs プロジェクト: martongyiran/Andromeda
        public static async Task <Tuple <string, Star> > GetPriceDiff(Star current, Star[] targets)
        {
            try
            {
                List <Tuple <TradeWrapper, Star> > maxList = new List <Tuple <TradeWrapper, Star> >();

                foreach (var star in targets)
                {
                    if (await GetMaxDiff(current, star) != null)
                    {
                        maxList.Add(await GetMaxDiff(current, star));
                    }
                }

                if (maxList.Count > 0)
                {
                    var ship = await NavigationComputer.GetSpaceshipStatusAsync();

                    var maxList2 = maxList.OrderByDescending(x => x.Item1.Profit).ToList().FirstOrDefault();
                    if (maxList2.Item1.TotalProfit > 10000)
                    {
                        return(new Tuple <string, Star>(maxList2.Item1.ProductName, maxList2.Item2));
                    }
                    else if (ship.Money < 100000)
                    {
                        return(new Tuple <string, Star>(maxList2.Item1.ProductName, maxList2.Item2));
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);
                throw e;
            }
        }
コード例 #7
0
ファイル: TradeHelper.cs プロジェクト: martongyiran/Andromeda
        public static async Task <int> UsedCargoSpace()
        {
            try
            {
                var ship = await NavigationComputer.GetSpaceshipStatusAsync();

                int usedCargo = 0;

                foreach (var item in ship.Cargo)
                {
                    usedCargo += item.Stock;
                }

                return(usedCargo);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.StackTrace);

                throw e;
            }
        }