예제 #1
0
 public Faction(string factionName, int startingHandSize, int startingCredits, int clicksPerTurn, List<Shipyard> shipyards, Homeworld homeworld)
 {
     FactionName = factionName;
     StartingHandSize = startingHandSize;
     StartingCredits = startingCredits;
     ClicksPerTurn = clicksPerTurn;
     Shipyards = shipyards;
     Homeworld = homeworld;
 }
예제 #2
0
 public Faction(string factionName, int startingHandSize, int startingCredits, int clicksPerTurn, List <Shipyard> shipyards, Homeworld homeworld)
 {
     FactionName      = factionName;
     StartingHandSize = startingHandSize;
     StartingCredits  = startingCredits;
     ClicksPerTurn    = clicksPerTurn;
     Shipyards        = shipyards;
     Homeworld        = homeworld;
 }
    public void AddHomeworld(Homeworld homeworld, bool belongsToPlayer)
    {
        // instantiate
        Transform homeworldTransform = InstantiateCardPrefab(homeworld, belongsToPlayer);

        // position
        Transform constructionArea = (belongsToPlayer ? PlayerConstructionAreaGUI : OpponentConstructionAreaGUI);
        homeworldTransform.SetParent(constructionArea);
    }
예제 #4
0
    public void AddHomeworld(Homeworld homeworld, bool belongsToPlayer)
    {
        // instantiate
        Transform homeworldTransform = InstantiateCardPrefab(homeworld, belongsToPlayer);

        // position
        Transform constructionArea = (belongsToPlayer ? PlayerConstructionAreaGUI : OpponentConstructionAreaGUI);

        homeworldTransform.SetParent(constructionArea);
    }
    private Transform CreateHomeworldPrefab(Card card)
    {
        Transform transform = Instantiate(HomeworldPrefab);

        Homeworld homeworld = (Homeworld)card;

        var health = (Text)transform.Find("Health").GetComponent(typeof(Text));

        health.text = string.Format("{0}/{1}", homeworld.CurrentHealth, homeworld.MaxHealth);

        return(transform);
    }
예제 #6
0
        private static Orbit CreateOrbitForKerbal(PlacementRequest request)
        {
            var pos =
                Homeworld.GetWorldSurfacePosition(
                    request.Location.Coordinates.Latitude,
                    request.Location.Coordinates.Longitude,
                    request.Location.Coordinates.Altitude);
            var orbit = new Orbit(0, 0, 0, 0, 0, 0, 0, Homeworld);

            orbit.UpdateFromStateVectors(pos, Homeworld.getRFrmVel(pos), Homeworld, Planetarium.GetUniversalTime());
            $"created orbit for {Homeworld.name}".Debug();
            return(orbit);
        }
예제 #7
0
        public static WorldCoordinates GetFacilityCoordinates <T>() where T : SpaceCenterBuilding
        {
            var facilityVectorPosition =
                ((T)(SpaceCenter.FindObjectOfType(typeof(T))))
                .transform
                .position;

            var facilityCoordinates = new WorldCoordinates
            {
                Latitude  = Homeworld.GetLatitude(facilityVectorPosition),
                Longitude = Homeworld.GetLongitude(facilityVectorPosition),
                Altitude  = Homeworld.GetAltitude(facilityVectorPosition),
                World     = Homeworld,
            };

            return(facilityCoordinates);
        }
예제 #8
0
    public Deck()
    {
        _cards = new List <PlayableCard>();

        // temp hard coded deck
        Homeworld       homeworld = (Homeworld)CardFactory.CreateCard(CardCodename.DEFAULT_HOMEWORLD);
        List <Shipyard> shipyards = new List <Shipyard>();

        shipyards.Add((Shipyard)CardFactory.CreateCard(CardCodename.SHIPYARD));
        shipyards.Add((Shipyard)CardFactory.CreateCard(CardCodename.SMALL_SHIPYARD));
        Faction = new Faction("DefaultFaction", 8, 100, 10, shipyards, homeworld);
        AddCard(CardCodename.FRIGATE, 4);
        AddCard(CardCodename.CRUISER, 4);
        AddCard(CardCodename.BATTLESHIP, 4);
        AddCard(CardCodename.SMALL_SHIPYARD, 4);
        AddCard(CardCodename.SHORT_TERM_INVESTMENT, 4);
    }
예제 #9
0
    public Faction(string dataStr)
    {
        string[] data = dataStr.Split('|');

        FactionName      = data[0];
        StartingHandSize = int.Parse(data[1]);
        StartingCredits  = int.Parse(data[2]);
        ClicksPerTurn    = int.Parse(data[3]);
        Homeworld        = (Homeworld)CardFactory.CreateCard((CardCodename)Enum.Parse(typeof(CardCodename), data[4]), data[5]);
        Shipyards        = new List <Shipyard>();
        int numShipyards = int.Parse(data[6]);

        for (int i = 0; i < numShipyards; i++)
        {
            Shipyard shipyard = (Shipyard)CardFactory.CreateCard((CardCodename)Enum.Parse(typeof(CardCodename), data[7 + (i * 2)]), data[8 + (i * 2)]);
            Shipyards.Add(shipyard);
        }
    }
예제 #10
0
        static void Main(string[] args)
        {
            displayWelcome();

            RestSharp.IRestResponse apiResponse = getResponse("https://swapi.dev/api/people/");

            StarWarsResponse apiJSON = JsonConvert.DeserializeObject <StarWarsResponse>(apiResponse.Content);

            foreach (var personaje in apiJSON.Results)
            {
                RestSharp.IRestResponse planetResponse = getResponse(personaje.Homeworld);
                Homeworld planetJSON = JsonConvert.DeserializeObject <Homeworld>(planetResponse.Content);

                Console.WriteLine("Nombre: " + personaje.Name);
                Console.WriteLine("Altura: " + personaje.Height);
                Console.WriteLine("Masa: " + personaje.Mass);
                Console.WriteLine("Planeta: " + planetJSON.name);
                Console.WriteLine("------------------");
            }
        }
예제 #11
0
파일: Character.cs 프로젝트: Marbax/NP
        /// <summary>
        /// url string -- the hypermedia URL of this resource.
        /// </summary>
        //public string Url { get; set; }

        /// <summary>
        /// vehicles array -- An array of vehicle resource URLs that this person has piloted.
        /// </summary>
        //public List<Vehicle> Vehicles { get; set; }

        public override string ToString()
        {
            StringBuilder sbShips = new StringBuilder();

            if (Starships.Count > 0)
            {
                sbShips.Append("{\n").Append(Starships.Select(f => f.ToString()).Aggregate((f, s) => f + " ,\n " + s)).Append("\n}");
            }
            else
            {
                sbShips.Append("no ships");
            }

            StringBuilder sbSpecies = new StringBuilder();

            if (Species.Count > 0)
            {
                sbSpecies.Append("{\n").Append(Species.Select(f => f.ToString()).Aggregate((f, s) => f + " ,\n " + s)).Append("\n}");
            }
            else
            {
                sbSpecies.Append("no species");
            }


            StringBuilder sb = new StringBuilder(BirthYear);

            sb.Append(" , ").Append(EyeColor).Append(" , ").Append($"[\n{Films?.Select(f => f?.ToString()).Aggregate((f, s) => f + " ,\n " + s)}\n] , ");
            sb.Append(Gender).Append(" , ").Append(HairColor).Append(" , ").Append(Height).Append(" , {").Append(Homeworld.ToString()).Append("} , ");
            sb.Append(Mass).Append(" , ").Append(Name).Append(" , ").Append(SkinColor).Append($" , [\n{sbShips.ToString()}\n]");
            sb.Append($" , [\n{sbSpecies.ToString()}\n]");

            return(sb.ToString());
        }
예제 #12
0
 void Awake()
 {
     instance = this;
 }