Exemplo n.º 1
0
 private void CreateNewAi(int count)
 {
     for (int i = count; i > 0; i--)
     {
         var aiView = viewManager.CreateView("AI");
         var ai     = aiView.GetComponent <AiCreator>();
         ai.SetTargetRoot(rootOrigin);
         ai.AiManager = this;
         unspawned.Add(ai);
     }
 }
Exemplo n.º 2
0
    void CreateCharacter(string playerName, NetConnection connection)
    {
        if (!InputValidator.LowercaseOnly(playerName))
        {
            return;
        }
        LoginServer.Account account;
        if (!loginServer.TryGetAccount(connection, out account))
        {
            return;
        }
        if (database.HasKey(playerName))
        {
            socket.Send("NameTakenResponse", connection);
            return;
        }

        NetStream playerData = NetStream.New();

        playerData.WriteString(playerName);
        playerData.WriteInt(100);
        playerData.WriteVector3(Vector3.zero);

        ulong key;

        if (!database.TryAdd(playerName, playerData, out key))
        {
            return;
        }
        if (!AddCharacterNameKey(key, account.Id))
        {
            database.TryDelete(key);
            playerData.Release();
            return;
        }
        playerData.Position = 0;
        viewManager.CreateView(connection, "Player", playerData);
    }
Exemplo n.º 3
0
        public void SpawnPickup(IInvItem item, Vector3 position)
        {
            PickupCreator pickup;

            if (unsetPickups.Count == 0)
            {
                var pickupObject = viewManager.CreateView("Pickup");
                pickup = pickupObject.GetComponent <PickupCreator>();
            }
            else
            {
                pickup = unsetPickups[0];
                unsetPickups.RemoveAt(0);
            }
            pickup.Set(item, position);
            setPickups.Add(pickup);
        }
Exemplo n.º 4
0
 private void SpawnPlayer(NetConnection connection)
 {
     viewManager.CreateView(connection, 0, "SimplePlayer");
 }
Exemplo n.º 5
0
 private void SpawnRequest(NetConnection conn)
 {
     Debug.Log("Spawning player...");
     netViewManager.CreateView(conn, 0, "Player");
 }