示例#1
0
    PlayerData CreateHumanPlayer()
    {
        PlayerData data      = new PlayerData();
        GameObject playerObj = Instantiate(playerPrefab, new Vector3(0, 10, 10), Quaternion.identity);

        // Camera stuff
        HumanBrain brain = playerObj.AddComponent <HumanBrain>();

        //BotBrain brain = playerObj.AddComponent<BotBrain>()
        brain.cam = Camera.main;
        Camera.main.GetComponent <TopDownCamera>().target = playerObj.transform;


        // Fill in the field
        data.controller      = playerObj.GetComponent <PlayerController>();
        data.team            = Teams.Team.PLAYER;
        data.controller.team = Teams.Team.PLAYER;
        data.brain           = brain;

        //TEST
        data.resources = 100;

        GameObject healthBar = Instantiate(healthBarPrefab, playerCanvas.transform);

        data.controller.healthBar = healthBar;



        return(data);
    }
示例#2
0
 public Human(int _x, int _y, Camp camp)
 {
     MyCamp    = camp;
     Brain     = new HumanBrain(this);
     X         = _x;
     Y         = _y;
     Character = 'H';
 }
示例#3
0
 public override void ServerInit()
 {
     base.ServerInit();
     this._brain = (HumanBrain)((Component)this).GetComponent <HumanBrain>();
     if (this.isClient)
     {
         return;
     }
     AIThinkManager.Add((IThinker)this);
     this.Invoke(new Action(this.EnableNavAgent), 0.25f);
 }