Liberi
An exergame built for kids with CP!
SpawnInfo.cs
1 using UnityEngine;
2 using System;
3 using System.Collections;
4 using System.Collections.Generic;
5 using System.Linq;
6 using Lidgren.Network;
7 using Janus;
8 using LiberiNet;
9 
13 public class SpawnInfo
14 {
18  public GameObject Prefab;
22  public Vector3 Position;
26  public Vector3 Direction;
30  public int OwnerPeerIndex;
34  public UJeli Details;
35 
36  internal void ReadFrom (NetIncomingMessage msg)
37  {
38  Prefab = Sync.GetSpawnablePrefab(msg.ReadString());
39  Position = msg.ReadVector3();
40  Direction = msg.ReadVector3();
41  OwnerPeerIndex = msg.ReadInt32();
42  Details = UJeli.Parse(msg.ReadString());
43  }
44 
45  internal void WriteTo (NetOutgoingMessage msg)
46  {
47  msg.Write(Prefab.name);
48  msg.Write(Position);
49  msg.Write(Direction);
50  msg.Write(OwnerPeerIndex);
51  msg.Write((Details != null) ? Details.ToString() : "");
52  }
53 }
GameObject Prefab
The prefab from which this object is instantiated.
Definition: SpawnInfo.cs:18
Vector3 Position
The position at which this object was spawned.
Definition: SpawnInfo.cs:22
int OwnerPeerIndex
The peer index of the peer which owns this object.
Definition: SpawnInfo.cs:30
Vector3 Direction
The direction this object was facing when it was spawned.
Definition: SpawnInfo.cs:26
Unity version of Jeli markup class.
Definition: UJeli.cs:10
This class server two main functions: 1) As a MonoBehaviour, it allows for network synchronization of...
Definition: Sync.cs:13
static GameObject GetSpawnablePrefab(string prefabId)
Get a spawnable prefab by ID.
Definition: Sync.Static.cs:133
The spawn-time information of a spawned object.
Definition: SpawnInfo.cs:13
UJeli Details
Additional spawn details.
Definition: SpawnInfo.cs:34