Beispiel #1
0
 // Start is called before the first frame update
 void Start()
 {
     scaleChange          = new Vector3(0.002f, 0.002f, 0.002f);
     positionChange       = new Vector3(randomX, randomY, forward);
     calibrationScript    = GameObject.FindObjectOfType <Callibration>();
     buttonsManagerScript = GameObject.FindObjectOfType <ButtonsManager>();
 }
Beispiel #2
0
 public void SelectManager(int s)
 {
     if (s == 0)
     {
         PanelGame.SetActive(false);
     }
     if (s == 1) // options
     {
         ButtonsManager.SetActive(false);
         Options.SetActive(true);
         Back.SetActive(true);
     }
     if (s == 2) // credits
     {
         ButtonsManager.SetActive(false);
         Credits.SetActive(true);
         Back.SetActive(true);
     }
     if (s == 3)
     {
         Options.SetActive(false);
         Credits.SetActive(false);
         ButtonsManager.SetActive(true);
         Back.SetActive(false);
     }
 }
Beispiel #3
0
 private void OnMouseDown()
 {
     buttons = Component.FindObjectOfType <ButtonsManager>();
     if (Input.GetMouseButtonDown(0) && buttons.activeButton == buttons.buttons[4])
     {
         Destroy(gameObject);
     }
 }
Beispiel #4
0
 protected override void Death()
 {
     if (Random.Range(0f, 15f) > scoreValue)
     {
         ButtonsManager.add((int)(scoreValue / 2f));
     }
     base.Death();
 }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     //else if (Instance != this)
     Destroy(gameObject);
 }
Beispiel #6
0
    private void Awake()
    {
        _buttonsManager = transform.parent.GetComponent <ButtonsManager>();

        //Get Number from string
        //Example: "Hello 123" => "123"
        Int32.TryParse(Regex.Match(name, @"\d+").Value, out ButtonNumber);
        Text = GetComponentInChildren <Text>().text;
        Text = Text.Split(' ').First();
    }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Beispiel #8
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     _player    = GameObject.Find("Player").GetComponent <PlayerController>();
     btnManager = GetComponent <ButtonsManager>();
 }
Beispiel #9
0
 // Use this for initialization
 void Start()
 {
     _buttonsManager = GetComponentInParent <ButtonsManager>();
     _costText       = GetComponentInChildren <Text>();
     if (_costText)
     {
         _costText.text = Defender.GetComponent <Defender>().StarCost.ToString();
     }
     else
     {
         Debug.LogWarning("Cost text object not found.");
     }
 }
    protected void placeBrick()
    {
        if (ButtonsManager.getAmount() < script.getValue())
        {
            ButtonsManager.flash();
            return;
        }

        timeout = 0.5f;
        if (script.placeSolid())
        {
            lego.transform.position += Vector3.up * script.getHeight();
            ButtonsManager.spend(script.getValue());
        }
    }
    private void addScore()
    {
        if (added)
        {
            return;
        }
        int buttons = ButtonsManager.getAmount();

        if (buttons > 0)
        {
            addValue.text = "+" + (buttons * multiplyButtons);
            ButtonsManager.spend(buttons);
            ScoreManager.add(buttons * multiplyButtons);
        }
        added = true;
    }
Beispiel #12
0
        static void Main(string[] args)
        {
            Console.WriteLine("App is up");
#if DEBUG
            Console.WriteLine("Waiting for debugger. Press any key to continue");
            Console.ReadKey();
#endif

            SSD1306Manager screenManager  = new SSD1306Manager();
            GpioController gpioController = new GpioController();
            ButtonsManager buttonsManager = new ButtonsManager();

            InitializeScreen(screenManager);
            Dictionary <int, bool> enabledRelays = InitializeRelays(gpioController);
            InitializeMatrixButtons(gpioController, buttonsManager);
            ApplicationLoop(screenManager, gpioController, buttonsManager, enabledRelays);
            DeinitializeRelays(gpioController);
            DeinitializeMatrixButtons(buttonsManager);
            TurnOffScreen(screenManager);

            Console.WriteLine("App is down");
        }
Beispiel #13
0
	// Use this for initialization
	void Start () {
        comboTextPlayer1 = spawner.comboTextPlayer1;
        comboTextPlayer2 = spawner.comboTextPlayer2;
		spiderTrail = spawner.spiderTrail;
		
		var players = GameObject.FindGameObjectsWithTag("Player");
        player = players[Random.Range(0, players.Length)];

		side = InputManager.getRandomSide ();
        switch (side)
        {
            case InputManager.Side.Left:
                foreach (var item in GetComponentsInChildren<Renderer>())
                {
                    item.sharedMaterial = darkMaterial;
                }
                break;

            case InputManager.Side.Right:
                foreach (var item in GetComponentsInChildren<Renderer>())
                {
                    item.sharedMaterial = lightMaterial;
                }
                break;
        }

		buttonsManager = GameObject.FindGameObjectWithTag ("ButtonsManager").GetComponent<ButtonsManager>();
		comboList = buttonsManager.getRandomCombo(comboLength, side);
		spiderCombo = new SpiderCombo (comboList, this);
		InputManager.possibleSpiderCombos.Add(spiderCombo);

        animator = GetComponent<Animator>();

		// Play fall sound
		gameObject.GetComponent<AudioSource>().clip = spiderFall;
        gameObject.GetComponent<AudioSource>().PlayScheduled(AudioSettings.dspTime + 1.0);

        myMovement = movement;
	}
 private void Awake()
 {
     serialScript         = GameObject.FindObjectOfType <SerialPortUtility.SerialPortUtilityPro>();
     callibration         = GameObject.FindObjectOfType <Callibration>();
     buttonsManagerScript = GameObject.FindObjectOfType <ButtonsManager>();
 }
Beispiel #15
0
        private static void ApplicationLoop(SSD1306Manager manager, GpioController controller, ButtonsManager buttonsManager, Dictionary <int, bool> enabledRelays)
        {
            Console.WriteLine("Start application loop");
            SetRelayStatus(manager, enabledRelays);
            while (true)
            {
                List <MatrixButton> pressedButtons = buttonsManager.ArePressed();
                foreach (var button in pressedButtons)
                {
                    int buttonIndex = _matrixButtons.IndexOf(button);
                    if (buttonIndex < 0)
                    {
                        continue;
                    }

                    int relayToEnable = _pinouts[buttonIndex];
                    if (!enabledRelays[relayToEnable])
                    {
                        controller.Write(relayToEnable, PinValue.Low);
                        enabledRelays[relayToEnable] = true;
                    }
                    else
                    {
                        controller.Write(relayToEnable, PinValue.High);
                        enabledRelays[relayToEnable] = false;
                    }
                }

                if (pressedButtons.Count > 0)
                {
                    SetRelayStatus(manager, enabledRelays);
                }

                Thread.Sleep(500);

                if (!enabledRelays.ContainsValue(false))
                {
                    break;
                }
            }
            Console.WriteLine("End application loop");
        }
Beispiel #16
0
 private static void DeinitializeMatrixButtons(ButtonsManager buttonsManager)
 {
     Console.WriteLine("DeInitialize matrix buttons");
     buttonsManager.Cleanup();
     Console.WriteLine("END DeInitialize matrix buttons");
 }
Beispiel #17
0
 private static void InitializeMatrixButtons(GpioController controller, ButtonsManager buttonsManager)
 {
     Console.WriteLine("Initialize Matrix Buttons");
     buttonsManager.Init(_matrixButtons, controller);
     Console.WriteLine("END Initialize Matrix Buttons");
 }
Beispiel #18
0
 private void Awake()
 {
     getBreathPacketScript = GameObject.FindObjectOfType <GetBreathPacket>();
     buttonsManagerScript  = GameObject.FindObjectOfType <ButtonsManager>();
 }
Beispiel #19
0
 // Start is called before the first frame update
 void Start()
 {
     _manager = GameObject.FindObjectOfType <ButtonsManager>();
 }