// Start is called before the first frame update void Start() { ControlFactors.SetDefaults(); PopulateMap(true); //Background.transform.position = new Vector3(-2 * Expansion_Distance, 2 * Expansion_Distance, 0); //Background.GetComponent<SpriteRenderer>().size = new Vector3(2 * Expansion_Distance, 2 * Expansion_Distance, 0); //Debug.Log("Map Generated"); Land = transform.Find("MeshHandler").GetComponent <MeshHandler>(); //mapGrid = new MapGrid(mapWidth, mapHeight, gridNodeWidth, gridNodeHeight); population = new Population(this); //PopulateGrid(); aPath.transform.position = new Vector3(aPath.transform.position.x - (Expansion_Distance), aPath.transform.position.y - (Expansion_Distance), 0); GridGraph g = aPath.data.gridGraph; g.SetDimensions((int)(Expansion_Distance * 2), (int)(Expansion_Distance * 2), 1f); g.nodeSize = .5f; g.collision.heightMask = LayerMask.GetMask("TileGrid"); //aPath.batchGraphUpdates = true; StartCoroutine(StartGrid(.5f)); //g.drawGizmos = true; }
public void close() { GameObject.FindGameObjectWithTag("MainCamera").GetComponent <ManualCamera>().setTarget(null); GameObject.FindGameObjectWithTag("GridController").GetComponent <UIHandler>().manMenuOpen = false; man.setStatMenuOpen(false); if (manRequest) { manRequest.currentMenu = null; manRequest.gameObject.SetActive(false); } ControlFactors.setPlayerCast(true); Destroy(gameObject); }
// Start is called before the first frame update void Start() { closeButton.onClick.AddListener(() => { close(); }); ControlFactors.setPlayerCast(false); if (man != null) { man.setStatMenuOpen(true); if (man.activeRequest) { man.activeRequest.gameObject.SetActive(true); manRequest = man.activeRequest; manRequest.currentMenu = this; } } _Label.SetText(man.title); _Love.SetText("Love: " + ((man.brain.Love / man.brain.maxEmotion) * 100f).ToString("F0") + "%"); _Fear.SetText("Fear: " + ((man.brain.Fear / man.brain.maxEmotion) * 100f).ToString("F0") + "%"); _State.SetText("State: " + man.state); }
// choice: 1 = yes, 2 = no, 3 = ignore public void chooseOption(int choice) { if (choice == 1) { // Applies Yes value if Yes is chosen if (offer.yesVal >= 0) { ControlFactors.LOVE += offer.yesVal; ControlFactors.FEAR -= offer.yesVal; } else { ControlFactors.FEAR += Mathf.Abs(offer.yesVal); ControlFactors.LOVE -= Mathf.Abs(offer.yesVal); } } else if (choice == 2) { // Applies No value if no is chosen if (offer.noVal >= 0) { ControlFactors.LOVE += offer.noVal; ControlFactors.FEAR -= offer.noVal; } else { ControlFactors.FEAR += Mathf.Abs(offer.noVal); ControlFactors.LOVE -= Mathf.Abs(offer.noVal); } } else if (choice == 3) { float remainingLoss = offer.ignoreVal; // Takes what needs to be deducted and finds which factor is larger (Love or Fear), then deducteds the ignore val from the largest. // If there is a remainder, then the remainder is applied to the other value. if (ControlFactors.LOVE >= ControlFactors.FEAR) { if (ControlFactors.LOVE >= remainingLoss) { ControlFactors.LOVE -= remainingLoss; remainingLoss = 0; } else { remainingLoss -= ControlFactors.LOVE; ControlFactors.LOVE = 0; ControlFactors.FEAR -= remainingLoss; } } else { if (ControlFactors.FEAR >= remainingLoss) { ControlFactors.FEAR -= remainingLoss; remainingLoss = 0; } else { remainingLoss -= ControlFactors.FEAR; ControlFactors.FEAR = 0; ControlFactors.LOVE -= remainingLoss; } } } ControlFactors.setPlayerCast(true); SceneLoader.unloadOptionScene(); }
void Start() { offer = Offerings.getRandomOffer(Offerings.offeringList1); prompt.SetText(offer.Offering); ControlFactors.setPlayerCast(false); }
private void PlanAction(PlayerState setAction) // Sets the man's course of action depending on its current state { state = setAction; switch (state) { case PlayerState.atHome: // Was at Home, Now chooses Next activity { if (brain.Love / brain.maxEmotion > .95) { homeTile.ChangeTileStage(1); brain.changeFear(brain.maxEmotion / 4f); } float randomChoice = Random.Range(0, 10); if (randomChoice < 5) // Walk to random location (5/10) { state = PlayerState.travelToDestination; resting = false; SetSeeker(true); targetTile = gt.targetRandomMapTilePosition(this, home, level); seeker.StartPath(ABPath.Construct(transform.position, targetTile.spawnPos)); } else if (randomChoice == 5) // Walk to altar (1/10) { state = PlayerState.travelToAltar; resting = false; SetSeeker(true); seeker.StartPath(ABPath.Construct(transform.position, gt.AltarPos)); } else // Do Nothing { StartCoroutine(Rest(restTime)); } } break; case PlayerState.atDestination: //Was at Desination, goes home { state = PlayerState.travelToHome; resting = false; SetSeeker(true); seeker.StartPath(ABPath.Construct(transform.position, home, null)); } break; case PlayerState.atAltar: //Was at Altar, goes home { state = PlayerState.travelToHome; resting = false; SetSeeker(true); seeker.StartPath(ABPath.Construct(transform.position, home, null)); } break; case PlayerState.travelToDestination: { state = PlayerState.atDestination; //Decides if the target tile will get an update if (gt.ChanceForTileUpdate(targetTile)) { targetTile.ChangeTileStage(1); gt.calcDevelopmentScore(); Celebrate(1); } StartCoroutine(Rest(restTime / 2)); } break; case PlayerState.travelToHome: { state = PlayerState.atHome; StartCoroutine(Rest(restTime)); Celebrate(1); } break; case PlayerState.travelToAltar: { state = PlayerState.atAltar; //Now decides what to do at altar float randomChoice = Random.Range(1, 4); switch (randomChoice) { case 0: { // attempts to load option scene if (!SceneLoader.optionSceneActive()) { SceneLoader.loadOptionScene(); Debug.Log("Option Loaded"); } } break; case 1: { // Sacrifice brain.changeFear(1); ControlFactors.ChangeEnergy(3 * (1 + (ControlFactors.EMOTION / 100f))); Celebrate(2); } break; case 2: // Tribute { brain.changeFear(1); ControlFactors.ChangeEnergy(3 * (1 + (ControlFactors.EMOTION / 100f))); Celebrate(2); } break; case 3: // Sacrifice/Tribute Teir 2 { brain.changeBestTrait(3); ControlFactors.ChangeEnergy(5 * (1 + (ControlFactors.EMOTION / 100f))); Celebrate(2); } break; } StartCoroutine(Rest(restTime / 2)); } break; } }