コード例 #1
0
 private void OnChatRecive(string nickNmae, string message)
 {
     if (nickNmae == "Server")
     {
         if (message == "PlayerScore")
         {
             var _points = points.Get <Text>();
             score++;
             _points.text = score.ToString();
         }
         if (message == "EnemyScore")
         {
             var _points = enemyPoints.Get <Text>();
             enemyScore++;
             _points.text = enemyScore.ToString();
         }
         if (message.Contains("bonus"))
         {
             var msg = message.Split(",");
             var X   = int.Parse(msg[2]);
             var Y   = int.Parse(msg[3]);
             var id  = int.Parse(msg[4]);
             if (msg[1].Contains("speed"))
             {
                 var entity = entityFactory.BonusSpeed(new Vector2(X, Y));
                 entity.Get <IRigidBody>().id = id;
                 bonuses.Add(id, entity);
             }
         }
         if (message.Contains("destroy"))
         {
             Console.WriteLine("Remove bonus");
             var msg = message.Split(",");
             var id  = int.Parse(msg[1]);
             world.DestroyEntity(bonuses[id]);
             bonuses.Remove(id);
         }
     }
 }