Exemplo n.º 1
0
    private void OnPlayerUpdate(ComponentUpdateOp <Automaton.Player.Player> op)
    {
        if (op.EntityId != _entityId)
        {
            return;
        }
        IComponentUpdate <Automaton.Player.Player> update = op.Update;

        Automaton.Player.Player.Update u = update.Get();
        if (u.heartbeat.Count > 0)
        {
            _lastHeartbeat = Environment.TickCount;
        }
        if (u.killedPlayer.Count > 0)
        {
            foreach (var kp in u.killedPlayer)
            {
                var    killedEntity = kp.killed;
                Player player       = _game.GetPlayer(killedEntity);
                if (player == null)
                {
                    Console.WriteLine("Failed to find player ({0}) to kill", killedEntity);
                }
                else
                {
                    _score.AddKill();
                    player._score.AddDeath();
                }
            }
        }
    }
Exemplo n.º 2
0
        public void UnregisterForUpdate(IComponentUpdate component, params ComponentUpdatePass[] passes)
        {
            foreach (var pass in passes)
            {
                var list = passes_[pass];
                if (Application.isEditor)
                {
                    if (!list.Contains(component))
                    {
                        Debug.LogErrorFormat("Component (hash {0}) was not found in priority {1}.", component.GetHashCode(), pass);
                    }
                }

                list.ReplaceRemove(component);
            }
        }
Exemplo n.º 3
0
        public void RegisterForUpdate(IComponentUpdate component, params ComponentUpdatePass[] passes)
        {
            foreach (var pass in passes)
            {
                var list = passes_[pass];
                if (Application.isEditor)
                {
                    if (list.Contains(component))
                    {
                        Debug.LogErrorFormat("Component (hash {0}) is already added for priority {1}.", component.GetHashCode(), pass);
                    }
                }

                list.Add(component);
            }
        }
Exemplo n.º 4
0
 public void SendComponentUpdate <C>(EntityId entityId, IComponentUpdate <C> componentUpdate, bool legacyCallbackSemantics = false)
     where C : IComponentMetaclass
 {
     _connection.SendComponentUpdate <C>(entityId, componentUpdate, legacyCallbackSemantics);
 }
Exemplo n.º 5
0
 /// <inheritdoc />
 public void SendComponentUpdate <TComponent>(EntityId entityId, IComponentUpdate <TComponent> update, bool legacyCallbackSemantics = false) where TComponent : IComponentMetaclass
 {
     connection.SendComponentUpdate(entityId, update, legacyCallbackSemantics);
 }