void EnableDuel() //I slapped all the duel enabling shit in a function because it looked ugly lmao { duelCanvas.gameObject.SetActive(true); //turns the duel canvas on activeNPC.GetComponent <DuelManager>().enabled = true; //enables the duel manager on the npc we're interacting with activeDuel = activeNPC.GetComponent <DuelManager>(); //sets active duel to the duel manager on the npc we're interacting with //timeManager.modifier = 0f; //stops time from decreasing during the duel }
Coroutine type; //holds the typing coroutine private void Start() { timeManager = FindObjectOfType <TimeManager>(); //finds TimeManager script on start variableStorage = FindObjectOfType <VariableStorage>(); //finds VariableStorage script on start Transform dt = dialogueCanvas.gameObject.transform.Find("DialogueText"); //finds the Dialogue Text on start Transform it = dialogueCanvas.gameObject.transform.Find("Character"); //finds the character UI sprite on start nameText = dialogueCanvas.gameObject.transform.Find("NameText").GetComponent <Text>(); //assigns the name text on start characterImage = it.GetComponent <Image>(); //assigns the UI character sprite image dialogueText = dt.GetComponent <Text>(); //assigns the dialogue text dialogueText.color = normalText; //assigns the default text color duelTrigger = GameObject.Find("DuelTrigger"); //finds the duel trigger game object duelTrigger.SetActive(false); //turns the duel trigger off on start dialogueCanvas.gameObject.SetActive(false); //turns the dialogue canvas off at start duelCanvas.gameObject.SetActive(false); //turns the duel canvas off at start activeDuel = null; //sets active duel to null on start player = GameObject.FindGameObjectWithTag("Player"); //finds the player by tag on start currentGameState = GameState.IntroScene; descriptionText = descriptionCanvas.gameObject.transform.Find("Description").GetComponent <Text>(); descriptionText.text = null; descriptionCanvas.gameObject.SetActive(false); hudCanvas.gameObject.SetActive(false); toRun = introCutscene; }
/**********************************************************************************/ // функция дерегестрирует цель // производится проверка выигрыша игрока // /**********************************************************************************/ public void TargetIsDead(GameObject target) { if (GameManager.GetInstance().GameMode == GameManager.GAME_MODE.SINGLE) { CIGameObject gmo = target.GetComponent <CIGameObject>(); if (gmo.GOType == Base.GO_TYPE.PLAYER) { CompanyManager.GetInstance().OnGoalsFailed(); } else { m_npcTarget.Remove(gmo.ID); // обновляем текущую сложность int bossWeight = m_bossWeights[gmo.GOType.ToString()]; m_currentDifficulties -= bossWeight; UpdateNPCTargets(); if (m_npcTarget.Count == 0) { CompanyManager.GetInstance().OnGoalsAchieved(); } } } else { PlayerController pc = target.GetComponent <PlayerController>(); DuelManager.GetInstance().OnGoalAchived(pc.playerId); } }
private IEnumerator Start() { // менеджер локализации while (!LocalizationManager.instance.GetIsReady()) { yield return(null); } // менеджер диалогов while (!CompanyDialogManager.GetInstance().GetIsReady()) { yield return(null); } // менеджер компании while (!CompanyManager.GetInstance().GetIsReady()) { yield return(null); } // менеджер дуэли while (!DuelManager.GetInstance().GetIsReady()) { yield return(null); } // менеджер целей while (!TargetController.GetInstance().GetIsReady()) { yield return(null); } // после загрузки всех компонент - включаем меню SceneManager.LoadScene("MainMenu"); }
private Vector3 leftIdlePosition, rightIdlePosition; // Default idle position of players #endregion #region State Functions // Initialization void Start() { // Get required manager component manager = GetComponent <DuelManager>(); winCount = GetComponent <WinCountManager>(); // Set idle positions based on initial image positions leftIdlePosition = LeftSamurai.rectTransform.anchoredPosition; rightIdlePosition = RightSamurai.rectTransform.anchoredPosition; // Disable all text elements at beginning of round //.enabled = false; //RightCount.enabled = false; MainText.enabled = false; Flag.enabled = false; // Set shade over screen and hide flash screen Shade.Fill(); Flash.enabled = false; // Set event listeners EventManager.GameStart += Shade.Toggle; EventManager.GameReset += ClearForNewRound; EventManager.GameOver += ShowMatchWin; EventManager.GameResult += ShowResult; EventManager.GameStrike += ShowStrike; EventManager.GameReaction += ShowAttack; }
void Start() { if (GameManager.GetInstance().GameMode == GameManager.GAME_MODE.SINGLE) { CompanyManager.GetInstance().OnSceneLoaded(); } else if (GameManager.GetInstance().GameMode == GameManager.GAME_MODE.DUEL) { DuelManager.GetInstance().OnSceneLoaded(); } }
//private bool localPlayerInput; // True if local player input this frame // Update is called once per frame void Update() { if (!isLocalPlayer) { return; } // Check for touch or keyboard input if (TouchInput() || Input.GetKeyDown(KeyCode.Space)) { int reactionTime = DuelManager.Get().GetCurrentTime(); CmdTriggerReaction(isServer, reactionTime); } }
IEnumerator ShootDuel() { DuelManager.instance.endText.text = "Shoot!"; while (!(Input.deviceOrientation == DeviceOrientation.LandscapeLeft || Input.deviceOrientation == DeviceOrientation.LandscapeRight || Input.GetKey(KeyCode.Z))) { yield return(null); } while (!(Input.deviceOrientation == DeviceOrientation.Portrait || Input.deviceOrientation == DeviceOrientation.PortraitUpsideDown || Input.GetKey(KeyCode.X))) { yield return(null); } DuelManager.Vibrate(); DuelManager.instance.player.ShootSomeone(); }
IEnumerator ShootGroup() { DuelManager.instance.endText.text = "Shoot!"; StartCompassReading(); while (!(Input.deviceOrientation == DeviceOrientation.LandscapeLeft || Input.deviceOrientation == DeviceOrientation.LandscapeRight || Input.GetKey(KeyCode.Z))) { yield return(null); } while (!(Input.deviceOrientation == DeviceOrientation.Portrait || Input.deviceOrientation == DeviceOrientation.PortraitUpsideDown || Input.GetKey(KeyCode.X))) { yield return(null); } finishedShooting = true; DuelManager.Vibrate(); }
/**********************************************************************************/ // защищаемся от повторного создания объекта // /**********************************************************************************/ void Awake() { // защищаемся от повторного создания объекта if (s_instance == null) { s_instance = this; } else if (s_instance != this) { Destroy(gameObject); } // делаем GameManager неучтожимым при загрузке новой сцены (?) DontDestroyOnLoad(gameObject); }
public void DisplayEndResultGroup(bool won, string winner) { DuelManager.instance.GetMiniGame(currentMGIndex).ClearMiniGame(); DuelManager.instance.restartButton.SetActive(true); DuelManager.instance.restartNumber.SetActive(true); DuelManager.instance.UpdatePlayerRestartCount(false); if (won) { DuelManager.instance.endText.text = "You Won!!!"; } else { DuelManager.Vibrate(); DuelManager.instance.endText.text = winner + " won!"; } }
/**********************************************************************************/ // подготавливаем менеджер к дуэльной игре // /**********************************************************************************/ public void InitDuelGame() { Debug.Log("InitDuelGame"); GameMode = GAME_MODE.DUEL; // очищаем контроллер m_playerDict.Clear(); m_playerGameObj.Clear(); m_playerCtr_singleMode = null; m_playerGO_singleMode = null; m_singlePlayerID = PLAYER.NO_PLAYER; DuelManager.GetInstance().SetNewDuel(); GameAudioManager.Instance.SwitchToGameMode(); SceneManager.LoadScene("DuelLevel", LoadSceneMode.Single); }
private void Awake() { if (!instance) { instance = this; } else if (instance) { Destroy(gameObject); } player1 = _playerObj.GetComponent <Player>(); player2 = _computerObj.GetComponent <Player>(); aIDuelest = _computerObj.GetComponent <AIDuelest>(); gameActions = GetComponent <GameActions>(); turnPlayer = player1; }
private bool inputReceived; // True if input has been received this round during gameplay #endregion #region Photon Behaviour API void Update() { // Stop if not the local player or input has been received if (!ShouldCheckForInput()) { return; } // Check for touch or keyboard input if (TouchInput() || Input.GetKeyDown(KeyCode.Space)) { inputReceived = true; // Trigger player reaction at the current time int reactionTime = DuelManager.Get().GetCurrentTime(); TriggerReaction(isHost, reactionTime); } }
// Update is called once per frame void Update() { // Get input status CheckInput(); // Submit reaction inputs from either player if (manager.WaitingForInput()) { int reactionTime = DuelManager.Get().GetCurrentTime(); if (leftPlayerInput) { manager.TriggerReaction(true, reactionTime); } if (rightPlayerInput) { manager.TriggerReaction(false, reactionTime); } } }
public GameEngine(ILogHelper log) { Definer.Instance().Init(this); _propertyManager = new PropertyManager(); _propertyManager.Engine = this; _skillManager = new SkillManager(); _skillManager.Engine = this; _coreManager = new CoreManager(); _coreManager.Engine = this; _playerManager = new PlayerManager(); _damageTypeManager = new DamageTypeManager(); _damageTypeManager.Engine = this; _statusManager = new StatusManager(); _statusManager.Engine = this; _statManager = new StatManager(this); _playerManager.Engine = this; _classManager = new ClassManager(); _classManager.Engine = this; _duelManager = new DuelManager(); _duelManager.Engine = this; _log = log; Players = new Dictionary <string, Entity>(); Enemies = new Dictionary <string, Entity>(); Timer = new MockTimer(); Sanit = new Sanitizer(this); DeclaredVariables = new Dictionary <string, MeVariable>(); commandsQueue = new ConcurrentQueue <Command>(); _nextSave = Timer.GetFuture(GameConstants.SAVE_INTERVAL); }
public virtual void Update() { if (clueNeededToDuel == null && duelingStatus == DuelingStatus.PreDuel) { duelingStatus = DuelingStatus.CanDuel; } else { ManageDuels(); } switch (duelingStatus) { case DuelingStatus.PreDuel: treeToLoad = npcInfo.preDuelTrees[preDuelIndex]; break; case DuelingStatus.CanDuel: treeToLoad = npcInfo.dialogueTrees[dialogueIndex]; break; case DuelingStatus.PostDuel: treeToLoad = npcInfo.postDuelTrees[postDuelIndex]; break; } try{ thisDuelManager = GetComponent <DuelManager>(); CheckForPlayer(); ManageDossierInformation(); switch (attitude) { case Attitude.AngryIfLose: if (thisDuelManager.playerWin) { AngryAtPlayer = true; } break; case Attitude.AngryIfWin: if (thisDuelManager.playerLose) { AngryAtPlayer = true; } break; case Attitude.AngryIfOthersLose: SympatheticNPC(); break; case Attitude.AlwaysAngry: if (thisDuelManager.duelFinished) { AngryAtPlayer = true; } break; } thisDuelManager.enemyId = newDuelId; } catch (System.NullReferenceException) {} switch (currentStatus) { case NPCStatus.Neutral: heatedTimer = 10f; heatedIcon.gameObject.SetActive(false); break; case NPCStatus.Heated: heatedTimer -= Time.deltaTime; heatedIcon.gameObject.SetActive(true); Color heat = heatedIcon.GetComponent <SpriteRenderer>().color; heat.a = heatedTimer / 10f; heatedIcon.GetComponent <SpriteRenderer>().color = heat; if (heatedTimer <= 0f) { currentStatus = NPCStatus.Neutral; } break; } }
private bool rightPlayerInput; // True if right player input this frame #endregion #region State Functions // Initialization void Start() { manager = GetComponent <DuelManager>(); }
private void Start() { effects = DuelManager.instance.GetComponent <Effects>(); duelManager = DuelManager.instance; }
private void Update() { if (currentGameState == GameState.OverworldActive) { hudCanvas.gameObject.SetActive(true); introLineIndex = 0; introSceneIndex = 0; toRun = null; } if (currentGameState == GameState.IntroScene) { RunCutScene(toRun, cutsceneText); } else if (currentGameState == GameState.Win || currentGameState == GameState.TimerOut) { toRun = endingCutscene; cutsceneCanvas.gameObject.SetActive(true); hudCanvas.gameObject.SetActive(false); RunCutScene(toRun, cutsceneText); } else { cutsceneCanvas.gameObject.SetActive(false); } if (currentGameState == GameState.DialogueActive) //turns the dialogue canvas on and runs dialogue when dialogue is triggered { dialogueCanvas.gameObject.SetActive(true); hudCanvas.gameObject.SetActive(false); RunDialogue(); } else if (currentGameState != GameState.DialogueActive) //turns the dialogue canvas off and stops dialogue when dialogue is finished or cancelled { dialogueCanvas.gameObject.SetActive(false); StopDialogue(); } if (currentGameState == GameState.DescriptionActive) { descriptionCanvas.gameObject.SetActive(true); RunDescription(); } else if (currentGameState != GameState.DescriptionActive) { descriptionCanvas.gameObject.SetActive(false); StopDescription(); } if (currentGameState == GameState.DuelActive) { EnableDuel(); //enables the duel when it is triggered hudCanvas.gameObject.SetActive(false); if (activeDuel.duelFinished && currentGameState != GameState.DialogueActive) { //timeManager.modifier = 1f; //resumes time when the duel concludes if (activeDuel.playerLose) //player loss handling { if (Input.GetKeyDown(KeyCode.Space)) { ReprimandPlayer(1f); //reprimands player upon loss when they press space activeDuel.enabled = false; //turns of the duel component on the npc we're interacting with bgDuel.Stop(); bgNorm.Play(); Debug.Log("duel music stop"); //duel ends StartDialogue(activeNPC.lossTree); } } else if (activeDuel.playerWin) //player win handling { if (Input.GetKeyDown(KeyCode.Space)) { activeDuel.Reset(); //reset the duel componenet on the npc activeDuel.enabled = false; //turn the duel component on the npc off bgDuel.Stop(); bgNorm.Play(); Debug.Log("duel music stop"); //duel ends StartDialogue(activeNPC.informationReward); //run the information to load tree on the npc activeNPC.duelingStatus = NPC.DuelingStatus.PostDuel; } } } } else { try { activeNPC.GetComponent <DuelManager>().enabled = false; //this shit doesn't work but i'm too afraid to comment it out tbfh lmao activeDuel = null; duelCanvas.gameObject.SetActive(false); } catch (System.NullReferenceException) { } } }
private void RpcTriggerReaction(bool hostSamurai, int reactionTime) { DuelManager.Get().TriggerReaction(hostSamurai, reactionTime); }
void Start() { instance = this; instance.setupDone = false; Invoke("GetPlayersMG", 1f); }
private void Start() { effects = GetComponent <Effects>(); duelManager = DuelManager.instance; effectResolveLocation = duelManager.effectResolveLocation; }
// Sets the manager for the duel this player is in public void SetManager(DuelManager _manager) { manager = _manager; }
private void Start() { player = GetComponent <Player>(); duelManager = DuelManager.instance; gameActions = duelManager.gameActions; }