Example #1
0
    public void AddTouch(ActorSync a)
    {
        if (a.tag == "Keeper")
        {
            return;
        }

        ActorTouches.Add(a);

        if (ActorTouches.Count > 5)
        {
            ActorTouches.Remove(ActorTouches [0]);
        }
    }
Example #2
0
        private void InitializeMap()
        {
            _fsmActors   = GameObject.FindObjectsOfType <Fragsurf.FSM.Actors.FSMActor>();
            _spawnPoints = GameObject.FindObjectsOfType <Fragsurf.FSM.Actors.FSMSpawnPoint>();

            var dynamicActors = GameObject.FindObjectsOfType <MonoBehaviour>().OfType <IHasNetProps>();
            var uniqueIndex   = int.MaxValue;

            foreach (var actor in dynamicActors)
            {
                actor.UniqueId = uniqueIndex;
                uniqueIndex--;
                if (GameServer.Instance != null)
                {
                    var ent = new ActorSync(actor.UniqueId, GameServer.Instance);
                    GameServer.Instance.EntityManager.AddEntity(ent);
                }
            }

            foreach (var actor in _fsmActors)
            {
                if (actor is FSMTrigger trigger)
                {
                    foreach (var collider in trigger.GetComponentsInChildren <Collider>())
                    {
                        collider.gameObject.tag = "Trigger";
                    }
                }
                if (actor is IProxyActor proxy)
                {
                    var t            = Type.GetType(proxy.ProxyTarget);
                    var targetObj    = (FSMActor)actor.gameObject.AddComponent(t);
                    var srcFields    = actor.GetType().GetFields().Where(f => f.IsPublic);
                    var targetFields = t.GetFields().Where(f => f.IsPublic);
                    foreach (var srcField in srcFields)
                    {
                        var targetField = targetFields.First(x => x.Name == srcField.Name);
                        targetField.SetValue(targetObj, srcField.GetValue(actor));
                    }
                }
            }
        }
Example #3
0
	public void AddTouch(ActorSync a)
	{
		if (a.tag == "Keeper")
			return;

		ActorTouches.Add (a);

		if (ActorTouches.Count > 5)  
		{
			ActorTouches.Remove (ActorTouches [0]);
		}
	}