// Update is called once per frame void Update() { lastPosit = this.transform.position.z; distTraveled = lastPosit - this.transform.position.z; if (this.currentState != GameState.instance.state) { currentSpeed = MoveSpeed(); this.currentState = GameState.instance.state; } //move level this.transform.Translate(Vector3.back * currentSpeed * Time.deltaTime, Space.World); if (GameState.instance.state != GameState.gameStates.caught) { //increase current speed if (currentSpeed < normLevelSpeed) { currentSpeed += accel * Time.deltaTime; } //reset game state else if (currentSpeed >= normLevelSpeed) { GameState.instance.hazardHitCnt = 0; } } }
public void build(GameState.gameStates stateToBeginIn = GameState.gameStates.COMMANDSEQUENCE, GameState.gameStates stateToEndIn = GameState.gameStates.PROWL) { myGameState.currentGameState = stateToBeginIn; this.commandList.Enqueue(new SequenceEndCommand(stateToEndIn)); myCommandProcessor.setQueue(this.commandList); myCommandProcessor.executeNextCommand(); }
// Use this for initialization void Start() { this.rigidbody.freezeRotation = true; playerMotor = GetComponent <PlayerMotor>(); //log box collider's original size and center point origColliderSizeY = ((BoxCollider)collider).size.y; origColliderCenterY = ((BoxCollider)collider).center.y; this.currentState = GameState.instance.state; currentSpeed = MoveSpeed(); }
void SpeedControl() { distTraveled = transform.localPosition.z; if (this.currentState != GameState.instance.state) { currentSpeed = MoveSpeed(); this.currentState = GameState.instance.state; } if (GameState.instance.state != GameState.gameStates.caught) { //increase current speed if (currentSpeed < normLevelSpeed) { currentSpeed += accel * Time.deltaTime; } //reset game state else if (currentSpeed > normLevelSpeed) { GameState.instance.hazardHitCnt = 0; } } }
private void updateUIComponentsForState(GameState.gameStates currentState) { this.deactivateUIComponents(); if (currentState == GameState.gameStates.COMMANDSEQUENCE) { mainPanel.SetActive(true); characterPanel.gameObject.SetActive(true); sequenceButtonsPanel.SetActive(true); updatePotentialPartnersSprites(myDialogueManager.getAllCurrentLocalPresentConversationPartners()); } else if (currentState == GameState.gameStates.CUTSCENE) { updateUIForCutSceneState(); } else if (currentState == GameState.gameStates.PROWL) { mainPanel.SetActive(true); mainPanelButtonsPanel.SetActive(true); mapButton.SetActive(!mySceneCatalogue.getIsInInteriorScene()); characterPanel.gameObject.SetActive(true); toggleMainPanelIfUIEnabled(mapPanel, this.mapEnabled); toggleMainPanelIfUIEnabled(journalPanel, this.journalEnabled); if (mainPanel.activeSelf == true) { myAnimationMaestro.writeDescriptionText(mySceneCatalogue.getLocationDescription(), textPanel); updatePotentialPartnersSprites(myDialogueManager.getAllCurrentLocalPresentConversationPartners()); updateSelectedPartnerButtonUI(); updateToggleInteriorButtonUI(); } } else if (currentState == GameState.gameStates.CONVERSATION) { dialoguePanel.SetActive(true); characterPanel.gameObject.SetActive(true); Image speakerPortrait = GameObject.Find("SpeakerPortrait").GetComponent <Image>(); speakerPortrait.sprite = BackgroundSwapper.createSpriteFromTex2D(myConversationTracker.currentConversation.speaker.portrait); askOnDateButton.SetActive(myConversationTracker.canAskOnDateEnabled()); } else if (currentState == GameState.gameStates.DATEINTRO) { mainPanel.SetActive(true); dateButtonsPanel.SetActive(myRelationshipCounselor.isAtDate); dateActionButton.SetActive(!myRelationshipCounselor.getDateAbandonedOrExperienced()); dateActionButton.GetComponentInChildren <Text>().text = mySceneCatalogue.getCurrentLocation().currentDateAction; characterPanel.gameObject.SetActive(true); updatePotentialPartnersSprites(new List <Character>() { myRelationshipCounselor.getDatePartner(mySceneCatalogue.getCurrentLocation(), myTimelord.getCurrentTimestep()) }); myAnimationMaestro.writeDescriptionText(mySceneCatalogue.getCurrentLocation().descriptionDate, textPanel); } else if (currentState == GameState.gameStates.DATE) { mainPanel.SetActive(true); dateButtonsPanel.SetActive(myRelationshipCounselor.isAtDate); dateActionButton.SetActive(!myRelationshipCounselor.getDateAbandonedOrExperienced()); dateActionButton.GetComponentInChildren <Text>().text = mySceneCatalogue.getCurrentLocation().currentDateAction; characterPanel.gameObject.SetActive(true); updatePotentialPartnersSprites(new List <Character>() { myRelationshipCounselor.getDatePartner(mySceneCatalogue.getCurrentLocation(), myTimelord.getCurrentTimestep()) }); } else if (currentState == GameState.gameStates.DATECUTSCENE) { mainPanel.SetActive(true); characterPanel.gameObject.SetActive(true); sequenceButtonsPanel.SetActive(true); updatePotentialPartnersSprites(GameObject.FindObjectOfType <CommandBuilder>().dateCutSceneCharList); } else if (currentState == GameState.gameStates.DATEOUTRO) { mainPanel.SetActive(true); dateButtonsPanel.SetActive(true); dateActionButton.SetActive(!myRelationshipCounselor.getDateAbandonedOrExperienced()); myAnimationMaestro.writeDescriptionText("One good date can change your life.", textPanel); } }
// Use this for initialization void Start() { levelParent = this.transform; this.currentState = GameState.instance.state; currentSpeed = MoveSpeed(); }
public SequenceEndCommand(GameState.gameStates toEndIn) { myGameState = GameObject.FindObjectOfType <GameState>(); myCommandBuilder = GameObject.FindObjectOfType <CommandBuilder>(); this.toEndIn = toEndIn; }