void Awake() { //assign agent actions var agentActions = GetComponent<AgentActions>(); actionDataList = agentActions.proactiveActions; agent = GetComponent<TileAgent>(); agent.agentActions = agentActions; //create ui for the agent CreateUI (); }
public void GenerateLevel() { for (int j = 1; j < Height; j++) { int NoneTier = Mathf.Clamp(9 - j, 1, 9); int LowTier = NoneTier + Mathf.Clamp(15 - j, 5, 15); int MidLowTier = LowTier + Mathf.Clamp(45 - j, 25, 45); int MidTier = MidLowTier + Mathf.Clamp(25 + j, 25, 45); int MidHighTier = MidTier + Mathf.Clamp(5 + j, 1, 9); int HighTier = MidHighTier + Mathf.Clamp(1 + j, 1, 9); for (int i = 0; i < Width; i++) { int tileId = 0; int diceRnd = Random.Range(0, 100); if (diceRnd <= NoneTier) { tileId = 0; } else if (diceRnd <= LowTier) { tileId = 1; } else if (diceRnd <= MidLowTier) { tileId = 2; } else if (diceRnd <= MidTier) { tileId = 3; } else if (diceRnd <= MidHighTier) { tileId = 4; } else if (diceRnd <= HighTier) { tileId = 5; } GameObject go = GameObject.Instantiate(TilePrefabs[tileId], new Vector3(i, -j, 0), Quaternion.identity); go.transform.SetParent(this.transform); TileAgent tile = go.GetComponent <TileAgent>(); tile.X = i; tile.Y = j; //tile.Value = 0; } } }
public int AddNewTask(int x, int y, int type, TileAgent tile) { Task task = new Task(); task.X = x; task.Y = y; task.Type = type; task.Value = 0; task.Status = 0; task.TaskTile = tile; task.TaskIcon = GameObject.Instantiate(TaskIconPrefab, new Vector3(x, -y, 0f), Quaternion.identity); task.TaskIcon.transform.SetParent(this.transform); TaskList.Add(task); return(TaskList.Count - 1); }
public bool RemoveFromTeam(TileAgent agent) { if (teamMembers.Contains(agent)) { teamMembers.Remove(agent); return true; } return false; //teamMembers.RemoveAll(x => x.agent == agent);//remove all instances of MemberInfos with the supplied Agent }
public void AddToTeam(TileAgent agent) { if (teamMembers == null) { teamMembers = new List<TileAgent>(); //teamMembers = new List<MemberInfo>(); } teamMembers.Add(agent); //teamMembers.Add(new MemberInfo(agent)); }
public void KillAgent(TileAgent agent) { if (enemyTeam.RemoveFromTeam(agent)) { //Debug.Log("An enemy has been slain!"); agent.Kill(); /* if (enemyTeam.numberOfTeamMembers == 0) { SceneTransitionHandler.singleton.LoadNextLevel(); } */ } if (playerTeam.RemoveFromTeam(agent)) { //Debug.Log("Game over, man! It's game over!"); //SceneTransitionHandler.singleton.ReloadLevel(); //Application.LoadLevel(firstSceneName); } }
public void ClearFrameInfo() { selectedTile = null; targetTile = null; selectedAgent = null; selectedAction = null; }
public void SetAggro(TileAgent newTarget) { aggroTarget = newTarget; }