// Use this for initialization void Start() { SetupStartingLevels(); //Get Components gridManager = FindObjectOfType <GridManager>(); wireVisualManager = FindObjectOfType <WireVisualManager>(); wireManager = FindObjectOfType <WireManager>(); visualGridManager = FindObjectOfType <VisualGridManager>(); levelSelectButtonsGenerator = FindObjectOfType <LevelSelectButtonsGenerator>(); levelButtonGenerator = FindObjectOfType <LevelButtonGenerator>(); //Do Debug Logic if (debug_StartGameOnLoad) { StartGame(""); } //Hide GridModeIndicator Color startColour = gridModeIndicator.GetComponent <Text>().color; startColour.a = 0.0f; gridModeIndicator.GetComponent <Text>().color = startColour; actualBackgroundColour = backgroundColour; orginalBackgroundColour = backgroundColour; }
private void Awake() { image = GetComponent <Image>(); linerenderer = GetComponent <LineRenderer>(); canvas = GetComponentInParent <Canvas>(); wireManager = GetComponentInParent <WireManager>(); }
// Use this for initialization void Start() { if (wireManager == null) { wireManager = GameObject.Find("WireManager").GetComponent <WireManager>(); } }
// Methods public virtual new void OnPointerDown(PointerEventData _eventData) { //Check for null Transform if (_eventData.button == PointerEventData.InputButton.Left) { if (m_rectTransform == null || m_canvas == null || m_visualGate == null || m_visualGridManager == null || m_gameplayManager == null || m_wireManager == null || m_infoPopup == null) { m_rectTransform = GetComponent <RectTransform>(); m_visualGate = GetComponent <VisualGate>(); m_canvas = FindObjectOfType <Canvas>(); m_visualGridManager = FindObjectOfType <VisualGridManager>(); m_gameplayManager = FindObjectOfType <GameplayManager>(); m_wireManager = FindObjectOfType <WireManager>(); m_infoPopup = FindObjectOfType <InfoPopup>(); } if (m_rectTransform != null && m_canvas != null && m_visualGate != null && m_visualGridManager != null && m_gameplayManager != null && m_wireManager != null) { if (!m_wireManager.IsInWireEditMode()) { DoStateTransition(SelectionState.Pressed, false); m_isBeingDragged = true; m_rectTransform.SetParent(m_gameplayManager.gridParent); StartCoroutine(OnDrag()); } } } }
private void Start() { //FRAME LOCK @ 60 #if UNITY_EDITOR Application.targetFrameRate = 999; #else Application.targetFrameRate = 60; #endif AdjustScreenOrientation(); if (scoreManager == null) { scoreManager = GetComponent <ScoreManager>(); } if (wireManager == null) { wireManager = GetComponent <WireManager>(); } int gameModeInt = PlayerPrefs.GetInt("GameMode"); gameMode = (GameMode)gameModeInt; if (gameMode == GameMode.Hard) { wireManager.AllWires.Clear(); foreach (Transform childWire in wireHolder_HardMode.transform) { childWire.gameObject.SetActive(true); childWire.transform.GetComponent <Animator>().speed = 1.0f; wireManager.AllWires.Add(childWire.gameObject); } } else if (gameMode == GameMode.Medium) { wireManager.AllWires.Clear(); foreach (Transform childWire in wireHolder_HardMode.transform) { childWire.gameObject.SetActive(true); childWire.transform.GetComponent <Animator>().speed = 0.5f; wireManager.AllWires.Add(childWire.gameObject); } } else { wireManager.AllWires.Clear(); foreach (Transform childWire in wireHolder_DefaultMode.transform) { childWire.gameObject.SetActive(true); wireManager.AllWires.Add(childWire.gameObject); } } scoreManager.InitialSetupUI(); }
void Start() { player = GameObject.FindWithTag("Player"); if (!player) { Debug.LogError("CurrentFlow: No player was found. Add a player to the scene."); } currentIndex = 0; speed = normalSpeed; WireManager.SortWires(); }
public void Init() { _dispatcher = new EventDispatcher(); _dispatcher.OnTriggerEvent += HandleOnTriggerEvent; Controller = new Controller(_dispatcher); ModelManager = new ModelManager(_dispatcher); ViewManager = new ViewManager(_dispatcher); _wireManager = new WireManager(_dispatcher); RegisterCommands(); RegisterModels(); RegisterViews(); RegisterWires(); }
void Update() { //If we're boosting, move at boostSpeed and enable boost particles. If not, move at normal speed and //disable boost particles. speed = boosting ? boostSpeed : normalSpeed; boostEmitter.SetActive(boosting); //If there are wires to follow in the level and if we're not past the last wire, int numOfWires = WireManager.GetCount(); if (numOfWires > 0 && currentIndex < numOfWires) { //If the current isn't transitioning between wires, if (!currentTransitioning) { //Move the current to towards its destination, the end of the wire it's on. Wire currentWire = WireManager.GetWire(currentIndex); transform.position = Vector3.MoveTowards ( transform.position, currentWire.end.position, speed * Time.deltaTime ); //Face in the same direction as the wire we're on. transform.forward = currentWire.transform.forward; //If the current is at the end of the current wire... if (transform.position.Equals(currentWire.end.position)) { //Go to the next wire and do all relevant logic. GoToNextWire(); } } //If the current IS transitioning between wires, else { //Move through the gap at a speed dictated by transitionSpeed. DoCurrentTransition(); } } //If there are wires in the level and we got this far, the wire's reached the end. Initiate //the win sequence. else if (numOfWires > 0) { EventDispatcher.Dispatch(new EventDefiner.LevelEnd(true)); CurrentBurst(); } }
public void DestroyPlug(bool dontRemoveFromBlock = false) { if (wire != null) { WireManager.UnwirePlug(this, wire); } Debug.Assert(block != null); if (!dontRemoveFromBlock) { block.RemovePlug(this); } Destroy(this.gameObject); }
void Start() { Time.timeScale = 1.0f; if (curScoreText == null) { Debug.LogWarning("Current Score Text Object Missing!"); } if (wireManager == null) { wireManager = GetComponent <WireManager>(); } if (modeManager == null) { modeManager = GetComponent <ModeManager>(); } }
public override void OnPointerEnter(PointerEventData eventData) { base.OnPointerEnter(eventData); if (m_infoPopup == null || m_visualGridManager == null || m_visualGate == null || wireManager == null) { m_infoPopup = FindObjectOfType <InfoPopup>(); m_visualGridManager = FindObjectOfType <VisualGridManager>(); m_visualGate = GetComponent <VisualGate>(); wireManager = FindObjectOfType <WireManager>(); } if (m_infoPopup != null) { if (m_infoPopup.SetText(m_visualGate.titleText, m_visualGate.descriptionText)) { m_isHighlighted = true; StartCoroutine(OnHighlight()); } } }
/// <summary> /// Moves the current between a wire gap in roughly transitionLength seconds. /// </summary> private void DoCurrentTransition() { //Add one step to transition progress. //We want the transition to happen in transitionLength seconds, so one "step" is however many seconds have //passed since last frame over the desired length. transitionProgress += Time.deltaTime / transitionLength; //Follow a path from the end of the last wire, to the player, to the next wire. //It's like it's arcing through the connection the player makes between the wires. Wire lastWire = WireManager.GetWire(currentIndex - 1); Wire currentWire = WireManager.GetWire(currentIndex); transform.position = ThreePointLerp ( lastWire.end.position, player.transform.position, currentWire.start.position, transitionProgress ); //Rotate to face toward our current destination. if (transitionProgress < 0.5f) { transform.LookAt(player.transform); } else { transform.LookAt(currentWire.start.transform); } //Once the transition has completed, set the current's position as a failsafe, reset transitionProgress, //and not that the transition has ended. if (transitionProgress >= 1) { transform.position = currentWire.start.position; transitionProgress = 0; currentTransitioning = false; } }
// Start is called before the first frame update void Start() { if (!main) { main = this; } //アバターコンポ animLayer_impact = animator.GetLayerIndex("impact Layer"); ikManager = animator.GetComponent <PlayerIKManager>(); breathingManager = animator.GetComponent <BreathingManager>(); //ボールコンポ ballRB = GetComponent <Rigidbody>(); ballCollider = GetComponent <SphereCollider>(); myContacts = GetComponent <ContactManager>(); wireManager = GetComponent <WireManager>(); //IK lookRotation = new GameObject("lookRotation").transform; lookRotation.parent = tAvatar; lookRotation.localPosition = Vector3.zero; lookForward = new GameObject("lookForward").transform; lookForward.parent = lookRotation; lookForward.localPosition = Vector3.forward; //キーバッファ key_B = KeyBufferManager.CreateKey(); key_R1 = KeyBufferManager.CreateKey(); key_L2 = KeyBufferManager.CreateKey(); }
/// <summary> /// Updates currentIndex and currentTransition depending on whether the wire the current /// is on is broken or not. /// </summary> private void GoToNextWire() { //Move on to the next wire, no matter what. currentIndex++; //If the wire the current was on just a second ago was broken... Wire lastWire = WireManager.GetWire(currentIndex - 1); if (lastWire.type == WireType.BrokenEnd) { //The player needs to be close for the current to get to the next wire. if (lastWire.playerClose) { currentTransitioning = true; } //If they aren't, the current fizzles out. Initiate the losing sequence. else { EventDispatcher.Dispatch(new EventDefiner.LevelEnd(false)); CurrentBurst(); } } }
private void OnEnable() { WireManager.AddWire(this); }
private void OnDisable() { WireManager.RemoveWire(this); }
public void Setup() { cut = new WireManager(); }
public void DestroyWire() { WireManager.UnwirePlug(begin, this, false); WireManager.UnwirePlug(end, this, false); Destroy(this.gameObject); }
public FuelManager(IOutputWriter outputWriter) { this.outputWriter = outputWriter; wireManager = new WireManager(); }
private void Start() { Instance = this; RandomizeWirePositions(draggableWires); RandomizeWirePositions(socketWires); }
// Use this for initialization void Start() { wireManager = FindObjectOfType <WireManager>(); visualGridManager = FindObjectOfType <VisualGridManager>(); gridManager = FindObjectOfType <GridManager>(); }