Esempio n. 1
0
    static public void RecycleName(ShipAbstract s)
    {
        string n = usedNamesShip[s];

        usedNames.Remove(n);
        names.Add(n);
    }
Esempio n. 2
0
    static public string AssignName(ShipAbstract ship)
    {
        int    index = rand.Next(0, names.Count);
        string name  = names[index];          //AssignNumeral(names[]) ?? names[rand.Next(0, names.Count)];

        names.Remove(name);
        usedNames.Add(name);
        Frequency [name]++;
        usedNamesShip.Add(ship, name);
        return(ship.BaseType.ToString() + " " + name + AssignNumeral(name));
    }
Esempio n. 3
0
    public static void Build()
    {
        Berth open     = active.Berths[0];
        bool  openslot = false;

        foreach (Berth b in active.Berths)
        {
            if (!b.Full)
            {
                openslot = true;
            }
        }
        if (!openslot)
        {
            Debug.Log("No open slots");
            return;
        }
        int i = 0;

        while (open.Full)
        {
            i++;
            open = active.Berths [i];
        }
        Debug.Log("Open Berth is #" + open.Designation);
        GameObject   s  = Instantiate(ShipAbstract.ShipPrefabs[visual.value]);
        ShipAbstract sb = s.GetComponent <ShipAbstract> ();

        //	player.empire.Ships.Add (sb.gameObject.GetComponent<Ship> ());
        s.GetComponent <NavMeshAgent>().Warp(new Vector3(open.transform.position.x, .59f, open.transform.position.z));
        s.transform.rotation = Quaternion.Inverse(open.transform.rotation);
        sb.faction           = FAC.PLAYER;
        sb.shipClass.ImportDesign(ShipDesign.Designs[design.value]);
        //	player.empire.Unassigned [0].NewCommand (sb.GetComponent<ShipClass> ());

        //	sb.Start ();
        Debug.Log("Ship built");
    }