Exemplo n.º 1
0
        public static void Update()
        {
            if (rateLimiter.Update(updateRate) == false)
            {
                return;
            }

            var player = Player.main;

            if (player == null)
            {
                return;
            }

            var res = new ClientPlayerVitals();

            res.oxygen = player.GetOxygenAvailable();

            if (player.liveMixin != null)
            {
                res.health = player.liveMixin.health;
            }

            var survival = player.GetComponent <Survival>();

            if (survival != null)
            {
                res.food  = survival.food;
                res.water = survival.water;
            }

            Multiplayer.main.Send(res, DeliveryMethod.Sequenced);
        }
Exemplo n.º 2
0
        private void Process(ClientPlayerVitals msg)
        {
            if (msg.id == self.id)
            {
                var player = Player.main;
                if (player != null)
                {
                    if (player.liveMixin != null)
                    {
                        player.liveMixin.health = msg.health;
                    }

                    var survival = player.GetComponent <Survival>();
                    if (survival != null)
                    {
                        survival.food  = msg.food;
                        survival.water = msg.water;
                    }
                }
            }
        }
Exemplo n.º 3
0
 private void Process(Client client, ClientPlayerVitals msg)
 {
     msg.id = client.id;
     client.player.vitals = msg;
 }