using System;
using Game.Script.battle.mode.GWorldSync01ModeScript;
using Script.battle;
using UnityEngine;

namespace Game.Script.battle.mode
{
    public class GWorldSync01ModeInput
    {
        //控制玩家的唯一标识
        public long Key;
        public Boolean IsAdd;   //是否加入游戏
        public Boolean IsRobot; //是否是人机

    }
    public class GWorldSync01Mode : GBaseMode<GWorldSync01ModeInput>
    {


        public GameObject player;
        
        public override void OnSyncUpdate(int dt, JNFrameInfo frame, GWorldSync01ModeInput input)
        {
            base.OnSyncUpdate(dt, frame, input);

            if (input != null && input.IsAdd)
            {
                //加入一个玩家
                var player1 = Instantiate(this.player, this.transform);
                player1.GetComponent<PlayerBot>().key = input.Key;
                player1.GetComponent<PlayerBot>().isRobot = input.IsRobot;
            }
        }
        
    }
}