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); }
public Human(int _x, int _y, Camp camp) { MyCamp = camp; Brain = new HumanBrain(this); X = _x; Y = _y; Character = 'H'; }
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); }