Example #1
0
    /// <summary>
    /// Give player enough time to leave the elevator before the gate closes behind them.
    /// </summary>
    /// <param name="otherObject"></param>
    /// <returns></returns>
    private IEnumerator WaitToCloseGate(GameObject otherObject)
    {
        // Open the gate.
        gateAnimator.SetTrigger("Open");
        gateAnimator.GetComponent <AudioSource>().Play();

        // Activate the SOS task.
        SOSTaskSequence.SetActive(true);

        if (PressedButton != null)
        {
            PressedButton.Invoke();
        }

        // HACK. Robert - I may have made a bad decision when I added the argument at the very end of InteractWithSelectedObject.cs.
        // I passed the GameObject's root, rather than the GameObject itself. I feel like I can only explain the consequences of this decision in person, however.
        // For now, suffice to say that this line works, it will likely always work, but it is a hack all the same.
        GameObject.FindGameObjectWithTag("Player").transform.SetParent(null);

        // Deactivate the elevator gate collider.
        elevatorGate.SetActive(false);

        // Give the player the opportunity to leave.
        yield return(new WaitForSeconds(waitTime));

        // Activate the gate collider again.
        elevatorGate.SetActive(true);

        // Close the gate.
        gateAnimator.SetTrigger("Close");
        gateAnimator.GetComponent <AudioSource>().Play();
    }
Example #2
0
    public void PerfromButtonAction(PressedButton pressedButton)
    {
        switch (pressedButton)
        {
        case PressedButton.Up:
        {
            Moveupwards(true);
        }
        break;

        case PressedButton.Down:
        {
            Moveupwards(false);
        }
        break;

        case PressedButton.Left:
        {
            MoveLeftRight(true);
        }
        break;

        case PressedButton.Right:
        {
            MoveLeftRight(false);
        }
        break;
        }
    }
Example #3
0
 private void OnButtonRelease(PointerEventData eventData)
 {
     if (eventData.pointerPressRaycast.gameObject == buttonsDictionary[current].gameObject)
     {
         PressedButton?.Invoke(UI.PressedButton.None);
     }
 }
Example #4
0
 void ResetButtons()
 {
     _buttonEnabled[0] = new bool[9];
     _buttonEnabled[1] = new bool[9];
     _buttonText[0]    = new string[9];
     _buttonText[1]    = new string[9];
     _buttonData[0]    = new PressedButton[9];
     _buttonData[1]    = new PressedButton[9];
 }
Example #5
0
 private void UseMana(int value)
 {
     mana.MANA -= value;
     manaButoonSlider.value = mana.MANA;
     pressedButton          = PressedButton.Mana;
     if (!isManaLoad)
     {
         StartCoroutine(Delay());
     }
 }
Example #6
0
 public void Fireball()
 {
     AudioManager.Instance.AudioSource.PlayOneShot(AudioManager.Instance.ButtonClick, 0.3f);
     if (fireball.Meteor_isReady)
     {
         Instantiate(meteorite, meteoriteSpot);
         fireball.Value             = 0;
         FireballButtonSlider.value = 0;
         pressedButton = PressedButton.Meteor;
         StartCoroutine(Delay());
     }
 }
Example #7
0
    public void Interact(GameObject interactingAgent)
    {
        PlaySound();
        TurnOffEmission();
        DisableSOSCanvas();
        DisableCollision();

        if (PressedButton != null)
        {
            PressedButton.Invoke();
        }
    }
Example #8
0
 private void Update()
 {
     foreach (Button.ButtonType PressedButton in Enum.GetValues(typeof(Button.ButtonType)))
     {
         if (Input.GetKeyDown((KeyCode)PressedButton))
         {
             if (PressedButtons.Count < buttonSequence.ButtonsInSequence.Length)
             {
                 PressedButtons.Add(PressedButton.ToString());
             }
             CompareButtons();
         }
     }
 }
Example #9
0
 public void SpawnThirdUnit()
 {
     AudioManager.Instance.AudioSource.PlayOneShot(AudioManager.Instance.ButtonClick, 0.3f);
     if (currentValueThird == MAX_VALUE && mana.MANA >= priceThirdUnit && IntCountUnits < MAX_PLAYER_UNITS)
     {
         Instantiate(SaveLoadManager.Instance.playerData.currentUnits[2], playerSpot);
         IntCountUnits              += 1;
         currentValueThird           = 0;
         thirdUnitButtonSlider.value = 0;
         pressedButton               = PressedButton.ThirdUnit;
         StartCoroutine(Delay());
         UseMana(priceThirdUnit);
     }
 }
Example #10
0
        public void Move(PressedButton button)
        {
            switch (button)
            {
            case PressedButton.Up: rigid.velocity = currentSpeed * Vector2.up; break;

            case PressedButton.Down: rigid.velocity = currentSpeed * Vector2.down; break;

            case PressedButton.Left:  rigid.velocity = currentSpeed * Vector2.left;; break;

            case PressedButton.Right: rigid.velocity = currentSpeed * Vector2.right; break;

            default: rigid.velocity = Vector2.zero; break;
            }
        }
Example #11
0
        public Program()
        {
            _buttonEnabled    = new bool[2][];
            _buttonEnabled[0] = new bool[9];
            _buttonEnabled[1] = new bool[9];

            _buttonText    = new string[2][];
            _buttonText[0] = new string[9];
            _buttonText[1] = new string[9];

            _buttonData    = new PressedButton[2][];
            _buttonData[0] = new PressedButton[9];
            _buttonData[1] = new PressedButton[9];

            _oreStatus   = new MaterialStatus();
            _ignotStatus = new MaterialStatus();

            // Find LCD Displays
            if (!InitDisplays())
            {
                Echo("ERROR ON STARTUP: LCD ERROR");
                return;
            }

            // Get Blocks we care about
            _cockpit   = GridTerminalSystem.GetBlockWithName("ACockpit") as IMyCockpit;
            _assembler = GridTerminalSystem.GetBlockWithName("Assembler") as IMyAssembler;

            _oreCargo      = GridTerminalSystem.GetBlockWithName("Ore Cargo Bin") as IMyCargoContainer;
            _ignotCargo    = GridTerminalSystem.GetBlockWithName("Ignot Cargo Bin") as IMyCargoContainer;
            _materialCargo = GridTerminalSystem.GetBlockWithName("Material Cargo Bin") as IMyCargoContainer;

            _bay1Connector = GridTerminalSystem.GetBlockWithName("Bay 1 Connector") as IMyShipConnector;
            _bay2Connector = GridTerminalSystem.GetBlockWithName("Bay 2 Connector") as IMyShipConnector;
            _bay3Connector = GridTerminalSystem.GetBlockWithName("Bay 3 Connector") as IMyShipConnector;
            _bay4Connector = GridTerminalSystem.GetBlockWithName("Bay 4 Connector") as IMyShipConnector;

            ////Runtime.UpdateFrequency = UpdateFrequency.Update100;
            init = true;

            Echo("Startup complete");

            StartWizard();
        }
Example #12
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.White;

            // Sonic
            PressedButton spankerButton = new PressedButton()
            {
                Width                  = 226,
                Height                 = 226,
                Text                   = string.Empty,
                Margin                 = new Thickness(40, 500, 0, 0),
                BackgroundImage        = "Content/spanker.wpk",
                PressedBackgroundImage = "Content/spankerPressed.wpk",
            };

            spankerButton.Entity.AddComponent(new AnimationUI());
            this.spankerAnimation = spankerButton.Entity.FindComponent <AnimationUI>();
            spankerButton.Click  += (s, o) =>
            {
                WaveServices.GetService <AnalyticsManager>().TagEvent("CharacterSelection", "Character", "Spanker");
            };
            EntityManager.Add(spankerButton);

            // Link
            PressedButton colonelButton = new PressedButton()
            {
                Width                  = 226,
                Height                 = 226,
                Text                   = string.Empty,
                Margin                 = new Thickness(288, 500, 0, 0),
                BackgroundImage        = "Content/colonel.wpk",
                PressedBackgroundImage = "Content/colonelPressed.wpk",
            };

            colonelButton.Entity.AddComponent(new AnimationUI());
            this.colonelAnimation = colonelButton.Entity.FindComponent <AnimationUI>();
            colonelButton.Click  += (s, o) =>
            {
                WaveServices.GetService <AnalyticsManager>().TagEvent("CharacterSelection", "Character", "Colonel");
            };
            EntityManager.Add(colonelButton);

            // Mario
            PressedButton fuzzButton = new PressedButton()
            {
                Width                  = 226,
                Height                 = 226,
                Text                   = string.Empty,
                Margin                 = new Thickness(536, 500, 0, 0),
                BackgroundImage        = "Content/fuzz.wpk",
                PressedBackgroundImage = "Content/fuzzPressed.wpk",
            };

            fuzzButton.Entity.AddComponent(new AnimationUI());
            this.fuzzAnimation = fuzzButton.Entity.FindComponent <AnimationUI>();
            fuzzButton.Click  += (s, o) =>
            {
                WaveServices.GetService <AnalyticsManager>().TagEvent("CharacterSelection", "Character", "Fuzz");
            };
            EntityManager.Add(fuzzButton);

            this.showSpanker = new SingleAnimation(0, -374, 0.5f, EasingFunctions.Back);
            this.showColonel = new SingleAnimation(0, -374, 0.5f, EasingFunctions.Back);
            this.showFuzz    = new SingleAnimation(0, -374, 0.5f, EasingFunctions.Back);
        }
Example #13
0
 public void OnPressedButton()
 {
     clubManager.StartByGuest(RoomName);
     PressedButton?.Invoke(this, EventArgs.Empty);
 }
Example #14
0
 public override String ToString()
 {
     return(String.Format("MouseEventArgs: [{0},{1}], {2}, [{3}] ", X, Y, PressedButton.ToString(), String.Join(",", UsedKeys.ToArray())));
 }
 private void buttonMiddle_Click(object sender, EventArgs e)
 {
     Result = PressedButton.Middle;
     Close();
 }
Example #16
0
 void SetButton(int button, bool enabled, string text, PressedButton pressedButton, int row = 0)
 {
     _buttonEnabled[row][button - 1] = enabled;
     _buttonText[row][button - 1]    = text;
     _buttonData[row][button - 1]    = pressedButton;
 }
Example #17
0
 private void OnButtonPressed(PointerEventData eventData)
 {
     current = buttonsDictionary.Single(x => x.Value.gameObject == eventData.pointerPressRaycast.gameObject).Key;
     PressedButton?.Invoke(current);
 }
 /// <summary>
 /// Supply a PressedButton and it will return a valueIdentical to the Unity Input Manager
 /// </summary>
 /// <param name="button"></param>
 /// <returns></returns>
 public bool GetButton(PressedButton button)
 {
     return(Input.GetKey(pressedKeycode[button]));
 }
Example #19
0
    //-----------------------------------------------------------
    // Coroutines
    //-----------------------------------------------------------

    IEnumerator LookForInteraction()
    {
        while (true)
        {
            List <Camera>        filteredCameras = GetFilteredCameraList();
            List <PressedButton> releasedButtons = new List <PressedButton>();

            //touch checking:
            if (Input.touchCount > 0)
            {
                foreach (Touch currentTouch in Input.touches)
                {
                    //press:
                    if (currentTouch.phase == TouchPhase.Began)
                    {
                        foreach (Camera currentFilteredCamera in filteredCameras)
                        {
                            //if the rendering camera is disabled we won't check for any interactions:
                            //if ( !currentFilteredCamera.enabled || !currentFilteredCamera.gameObject.active ) {
                            if (!currentFilteredCamera.enabled || !currentFilteredCamera.gameObject.activeInHierarchy)
                            {
                                break;
                            }
                            //look for interactions:
                            Ray        ray = currentFilteredCamera.ScreenPointToRay(currentTouch.position);
                            RaycastHit hit;
                            if (Physics.Raycast(ray, out hit, currentFilteredCamera.farClipPlane))
                            {
                                foreach (ColliderButton currentColliderButton in colliderButtons)
                                {
                                    if (currentColliderButton.useEvent && currentColliderButton.GetComponent <Collider>() == hit.collider)
                                    {
                                        if (currentColliderButton.debug)
                                        {
                                            Debug.Log(currentColliderButton.name + " was PRESSED at " + Time.realtimeSinceStartup + "!");
                                        }
                                        currentColliderButton.FirePressedEvent();

                                        //catalog this pressed collider button for use with release activities:
                                        PressedButton currentPressedColliderButton = new PressedButton(currentColliderButton, currentTouch.fingerId);
                                        pressedButtons.Add(currentPressedColliderButton);

                                        currentColliderButton.methodFire.Fire();
                                    }
                                }
                            }
                        }
                    }

                    //release:
                    if (currentTouch.phase == TouchPhase.Ended || currentTouch.phase == TouchPhase.Canceled)
                    {
                        //catalog buttons that are now released:
                        foreach (PressedButton item in pressedButtons)
                        {
                            if (item.touchedID == currentTouch.fingerId)
                            {
                                releasedButtons.Add(item);
                            }
                        }

                        //final clean up to ensure we don't have any stuck pressed buttons from notoriously error-prone touch reporting due to loop frequencies and the real world:
                        foreach (PressedButton item in pressedButtons)
                        {
                            if (item.touchedID > Input.touchCount - 1)
                            {
                                releasedButtons.Add(item);
                            }
                        }

                        //drop catalog of released buttons:
                        foreach (PressedButton item in releasedButtons)
                        {
                            item.colliderButton.FireReleasedEvent();
                            if (item.colliderButton.debug)
                            {
                                Debug.Log(item.colliderButton.name + " was RELEASED at " + Time.realtimeSinceStartup + "!");
                            }
                            pressedButtons.Remove(item);
                        }
                    }
                }
            }
            else
            {
                //mouse checking:

                //press:
                if (Input.GetMouseButtonDown(0))
                {
                    foreach (Camera currentFilteredCamera in filteredCameras)
                    {
                        //if the rendering camera is disabled we won't check for any interactions:
                        //if ( !currentFilteredCamera.enabled || !currentFilteredCamera.gameObject.active ) {
                        if (!currentFilteredCamera.enabled || !currentFilteredCamera.gameObject.activeInHierarchy)
                        {
                            break;
                        }
                        //look for interactions:
                        Ray        ray = currentFilteredCamera.ScreenPointToRay(Input.mousePosition);
                        RaycastHit hit;
                        if (Physics.Raycast(ray, out hit, currentFilteredCamera.farClipPlane))
                        {
                            foreach (ColliderButton currentColliderButton in colliderButtons)
                            {
                                if (currentColliderButton.useEvent && currentColliderButton.GetComponent <Collider>() == hit.collider)
                                {
                                    if (currentColliderButton.debug)
                                    {
                                        Debug.Log(currentColliderButton.name + " was PRESSED at " + Time.realtimeSinceStartup + "!");
                                    }
                                    currentColliderButton.FirePressedEvent();

                                    //catalog this pressed collider button for use with release activities:
                                    PressedButton currentPressedColliderButton = new PressedButton(currentColliderButton, 0);
                                    pressedButtons.Add(currentPressedColliderButton);

                                    currentColliderButton.methodFire.Fire();
                                }
                            }
                        }
                    }
                }

                //release:
                if (Input.GetMouseButtonUp(0))
                {
                    //catalog buttons that are now released:
                    foreach (PressedButton item in pressedButtons)
                    {
                        if (item.touchedID == 0)
                        {
                            releasedButtons.Add(item);
                        }
                    }
                }

                //drop catalog of released buttons:
                foreach (PressedButton item in releasedButtons)
                {
                    item.colliderButton.FireReleasedEvent();
                    if (item.colliderButton.debug)
                    {
                        Debug.Log(item.colliderButton.name + " was RELEASED at " + Time.realtimeSinceStartup + "!");
                    }
                    pressedButtons.Remove(item);
                }
            }

            yield return(null);
        }
    }
 private void buttonRight_Click(object sender, EventArgs e)
 {
     Result = PressedButton.Right;
     Close();
 }
Example #21
0
        void HandleButton(PressedButton button)
        {
            switch (button)
            {
            case PressedButton.None:
                break;

            case PressedButton.Restart:
                StartWizard();
                break;

            case PressedButton.Start:
                WizardPage1();
                break;

            case PressedButton.Bay1Selected:
                _baySelected  = 1;
                _remoteGridId = _bay1Connector.OtherConnector.CubeGrid.EntityId;
                WizardPage2();
                break;

            case PressedButton.Bay2Selected:
                _baySelected  = 2;
                _remoteGridId = _bay2Connector.OtherConnector.CubeGrid.EntityId;
                WizardPage2();
                break;

            case PressedButton.Bay3Selected:
                _baySelected  = 3;
                _remoteGridId = _bay3Connector.OtherConnector.CubeGrid.EntityId;
                WizardPage2();
                break;

            case PressedButton.Bay4Selected:
                _baySelected  = 4;
                _remoteGridId = _bay4Connector.OtherConnector.CubeGrid.EntityId;
                WizardPage2();
                break;

            case PressedButton.SelectAssemble:
                AssemblerWizard1();
                break;

            case PressedButton.SelectRefine:
                RefineWizard1();
                break;

            case PressedButton.StartAssemble:
                break;

            case PressedButton.StartRefine:
                RefineWizard2Page1();
                break;

            case PressedButton.GoBack:
                WizardPage2();
                break;

            case PressedButton.RefineNext:
                RefineWizard2Page2();
                break;

            case PressedButton.RefinePrev:
                RefineWizard2Page1();
                break;

            case PressedButton.RefineRestart:
                RefineWizard1();
                break;

            case PressedButton.RefineIron:
                RefineWizard3();
                _selectedOre       = ItemType.Iron;
                _selectedOreAmount = _oreStatus.GetAmount(ItemType.Iron);
                break;

            case PressedButton.RefineNickel:
                RefineWizard3();
                _selectedOre       = ItemType.Nickel;
                _selectedOreAmount = _oreStatus.GetAmount(ItemType.Nickel);
                break;

            case PressedButton.RefineCobalt:
                RefineWizard3();
                _selectedOre       = ItemType.Cobalt;
                _selectedOreAmount = _oreStatus.GetAmount(ItemType.Cobalt);
                break;

            case PressedButton.RefineMagnesium:
                RefineWizard3();
                _selectedOre       = ItemType.Magnesium;
                _selectedOreAmount = _oreStatus.GetAmount(ItemType.Magnesium);
                break;

            case PressedButton.RefineSilicon:
                RefineWizard3();
                _selectedOre       = ItemType.Silicon;
                _selectedOreAmount = _oreStatus.GetAmount(ItemType.Silicon);
                break;

            case PressedButton.RefineSilver:
                RefineWizard3();
                _selectedOre       = ItemType.Silver;
                _selectedOreAmount = _oreStatus.GetAmount(ItemType.Silver);
                break;

            case PressedButton.RefineGold:
                RefineWizard3();
                _selectedOre       = ItemType.Gold;
                _selectedOreAmount = _oreStatus.GetAmount(ItemType.Gold);
                break;

            case PressedButton.RefinePlatinum:
                RefineWizard3();
                _selectedOre       = ItemType.Platinum;
                _selectedOreAmount = _oreStatus.GetAmount(ItemType.Platinum);
                break;

            case PressedButton.RefineUranium:
                RefineWizard3();
                _selectedOre       = ItemType.Uranium;
                _selectedOreAmount = _oreStatus.GetAmount(ItemType.Uranium);
                break;

            case PressedButton.AssembleRestart:
                break;

            case PressedButton.AssembleNext1:
                break;

            case PressedButton.AssembleNext2:
                break;

            case PressedButton.AssembleNext3:
                break;

            case PressedButton.AssemblePrev1:
                break;

            case PressedButton.AssemblePrev2:
                break;

            case PressedButton.AssemblePrev3:
                break;

            case PressedButton.RefineSelectAll:
                _oreToRefine = _selectedOreAmount;
                RefineWizard4();
                break;

            case PressedButton.RefineSelectSome:
                WizardGetNumber();
                break;

            case PressedButton.RefineYes:
                DoRefine();
                // Do transfer here
                EchoD("DoRefine");
                break;

            case PressedButton.RefineChangeAmount:
                RefineWizard3();
                break;

            case PressedButton.Number0:
                break;

            case PressedButton.Number1:
                break;

            case PressedButton.Number2:
                break;

            case PressedButton.Number3:
                break;

            case PressedButton.Number4:
                break;

            case PressedButton.Number5:
                break;

            case PressedButton.Number6:
                break;

            case PressedButton.Number7:
                break;

            case PressedButton.Number8:
                break;

            case PressedButton.Number9:
                break;

            case PressedButton.Enter:
                break;

            case PressedButton.Backspace:
                break;
            }
        }