示例#1
0
    public void MoveDirection(ScreenInput input)
    {
        if(input == null)
        {
          GetComponentInChildren<Rigidbody>().velocity = Vector3.zero;
          return;
        }

        ScreenInput.Arrow arrow = input.arrow;
        if(arrow.Equals(ScreenInput.Arrow.Up))
        {
          GetComponentInChildren<Rigidbody>().velocity = Vector3.up * speed;
        }
        if(arrow.Equals(ScreenInput.Arrow.Down))
        {
          GetComponentInChildren<Rigidbody>().velocity = Vector3.down * speed;
        }
        if(arrow.Equals(ScreenInput.Arrow.Left))
        {
          GetComponentInChildren<Rigidbody>().velocity = Vector3.left * speed;
        }
        if(arrow.Equals(ScreenInput.Arrow.Right))
        {
          GetComponentInChildren<Rigidbody>().velocity = Vector3.right * speed;
        }
    }
示例#2
0
    public void MoveDirection(ScreenInput input)
    {
        if (input == null)
        {
            GetComponentInChildren <Rigidbody>().velocity = Vector3.zero;
            return;
        }

        ScreenInput.Arrow arrow = input.arrow;
        if (arrow.Equals(ScreenInput.Arrow.Up))
        {
            GetComponentInChildren <Rigidbody>().velocity = Vector3.up * speed;
        }
        if (arrow.Equals(ScreenInput.Arrow.Down))
        {
            GetComponentInChildren <Rigidbody>().velocity = Vector3.down * speed;
        }
        if (arrow.Equals(ScreenInput.Arrow.Left))
        {
            GetComponentInChildren <Rigidbody>().velocity = Vector3.left * speed;
        }
        if (arrow.Equals(ScreenInput.Arrow.Right))
        {
            GetComponentInChildren <Rigidbody>().velocity = Vector3.right * speed;
        }
    }
示例#3
0
 private void Awake()
 {
     instance        = this;
     textureQueue    = new Queue <Texture2D>();
     currentTextures = new Texture2D[stepFrames];
     rtHeight        = renderTexture.height;
     rtWidth         = renderTexture.width;
 }
示例#4
0
        /// <summary>
        /// Writes the specified string and moves the cursor to the next line.
        /// </summary>
        /// <param name="text">The string to write.</param>
        public void WriteLine(string text)
        {
            if (text.Length < charLength)
            {
                //Erase cursor:
                VGADriver.driver.DoubleBuffer_DrawFillRectangle((uint)LocX, (uint)LocY + 13, 8, 2, bColor);
                VGADriver.driver.DoubleBuffer_Update();
                // Go to next line:
                LocX  = 0;
                LocY += 12;
                txt.Append(text);
                ScreenInput.Add(text);
                EndLine += 1;
                // Draw string:
                VGADriver.driver._DrawACSIIString(EndLine.ToString() + ", " + charHeight.ToString() + ", " + ScreenInput.Count.ToString(), (uint)Color.White.ToArgb(), (uint)LocX, (uint)LocY);
                VGADriver.driver.DoubleBuffer_Update();
                // Go to next line:
                //LocX = 0;
                //LocY += 14;
                //DrawCursor(LocX, LocY);
                PromptLocX  = 0;
                PromptLocY += 12;
            }
            //else
            //{
            //    //Erase cursor:
            //    VGADriver.driver.DoubleBuffer_DrawFillRectangle((uint)LocX, (uint)LocY + 13, 8, 2, bColor);
            //    VGADriver.driver.DoubleBuffer_Update();
            //    string first = text.Substring(0, charLength - 1);
            //    // Go to next line:
            //    LocX = 0;
            //    LocY += 12;
            //    // Draw string:
            //    VGADriver.driver._DrawACSIIString(first, (uint)Color.White.ToArgb(), (uint)LocX, (uint)LocY);
            //    VGADriver.driver.DoubleBuffer_Update();
            //    ScreenInput.Add(first);
            //    string rest = text.Substring(charLength - 1);
            //    //Save last coordinates:
            //    LLocX = LocX + ((first.Length) * 8) - 8;
            //    LLocY = LocY;
            //    // Go to next line:
            //    LocX = 0;
            //    LocY += 12;
            //    // Draw string:
            //    VGADriver.driver._DrawACSIIString(rest, (uint)Color.White.ToArgb(), (uint)LocX, (uint)LocY);
            //    VGADriver.driver.DoubleBuffer_Update();
            //    txt.Append(text);
            //    ScreenInput.Add(rest);
            //    LocX = (rest.Length) * 8;
            //    EndLine += 2;
            //    //// Go to next line:
            //    //LocX = 0;
            //    //LocY += 12;
            //    PromptLocX = 0;
            //    PromptLocY += 24;

            //}
        }
示例#5
0
 // Start is called before the first frame update
 void Start()
 {
     ganzObj = transform.GetChild(0).gameObject;
     src     = GetComponent <AudioSource>();
     randUnlockPosition();
     SRManager.instance.playTTS(infoClip);
     screenInput = ScreenInput.instance;
     screenInput.deactivate(infoClip.length);
 }
示例#6
0
 // Start is called before the first frame update
 void Start()
 {
     input    = ScreenInput.instance;
     src      = GetComponent <AudioSource>();
     src.clip = normalSteps[0];
     src.Play();
     src.Pause();
     initPos = fireSprite.transform.position;
     anim.Play("Fire");
 }
示例#7
0
 internal void SaveToMemory()
 {
     ScreenInput.Add(currentDirectory + ">" + txt.ToString());
     txt.Clear();
     EndLine += 1;
     //Erase cursor:
     VGADriver.driver.DoubleBuffer_DrawFillRectangle((uint)LocX, (uint)LocY + 13, 8, 2, bColor);
     VGADriver.driver.DoubleBuffer_Update();
     Prompt();
 }
示例#8
0
 private void Start()
 {
     screenInput = ScreenInput.instance;
     src         = GetComponent <AudioSource>();
     if (src == null)
     {
         throw new System.Exception("No se encontró el componente Audio Source para reproducir sonido");
     }
     //reproducimos el audio inicial
     src.clip = introTTS;
     src.Play();
     screenInput.deactivate(introTTS.length);    //desactivamos el input mientras dure el audio
 }
示例#9
0
    private ScreenInput getMouseInput()
    {
        ScreenInput result = null;

        if (Input.GetMouseButtonDown(0 /*left*/))
        {
            result            = new ScreenInput();
            result.inputPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            result.state      = ScreenInput.State.Down;
        }

        return(result);
    }
示例#10
0
 public SaveLoadBlockset(Engine engine, BlockPlacer parentScreen)
     : base("Save or Load Prompt")
 {
     DemandPriority = true;
     text           = new ScreenText(this, "Type in the name of this set below.", engine.FontMain);
     AddElement(text);
     input             = new ScreenInput(this, engine.FontMain);
     input.InputString = engine.room.BlockSet.Name;
     AddElement(input);
     AddElement(new ScreenButton(this, "Save", engine.FontMain));
     AddElement(new ScreenButton(this, "Load", engine.FontMain));
     AddCloseButton(engine);
     this.parentScreen = parentScreen;
 }
示例#11
0
	private ScreenInput getMouseInput()
	{
		ScreenInput result = null;

		if(Input.GetMouseButtonDown(0 /*left*/))
		{
			result = new ScreenInput();
      Vector3 mouseInput = Input.mousePosition;
      mouseInput.z = 10;
			result.inputPoint = Camera.main.ScreenToWorldPoint(mouseInput);
			result.state = ScreenInput.State.Down;
		}

		return result;
	}
示例#12
0
	private ScreenInput getTouchInput()
	{
		ScreenInput result = null;
		if(Input.touchCount > 0)
		{
			Touch firstTouch = Input.GetTouch(0);
			if (firstTouch.phase == TouchPhase.Began)
			{
				result = new ScreenInput();
				result.inputPoint = Camera.main.ScreenToWorldPoint(firstTouch.position);
				result.state = ScreenInput.State.Down;
			}
		}

		return result;
	}
示例#13
0
 public InputPrompt(Engine engine, Screen parentScreen, String title, String text, String startText, bool CloseButton)
     : base(title)
 {
     DemandPriority = true;
     AddText(text, engine.FontMain);
     input             = new ScreenInput(this, engine.FontMain);
     input.InputString = startText;
     AddElement(input);
     AddElement(new ScreenButton(this, "OK", engine.FontMain));
     this.parentScreen = parentScreen;
     if (CloseButton)
     {
         AddCloseButton(engine);
     }
     Center(engine);
 }
示例#14
0
 // Start is called before the first frame update
 void Start()
 {
     gm          = GameManager.instance;
     screenInput = ScreenInput.instance;
     if (type == SRType.Room)
     {
         if (gm.isSceneNew(roomIndex))
         {
             gm.loadRoomFromFile(roomIndex);
             gm.instantiateRoom();
             gm.SaveData();
             if (intro != null && intro.length != 0)
             {
                 playTTS(intro);
                 deactivate(intro.length);
                 Invoke("introReadFocus", intro.length);
             }
             else
             {
                 introReadFocus();
             }
         }
         else
         {
             if (gm.onlinePlay) //MIRA SI HAY DATOS EN LA NUBE
             {
                 print("Datos online");
                 gm.loadFromWeb();
             }
             else //MIRA DATOS LOCALES
             {
                 print("Datos locales");
                 gm.loadLocalData();
             }
             gm.instantiateRoom();
             currentList.ReadFocus();
         }
         // Nos aseguramos de la asignación de los objetos
         // ya que Unity no garantiza el orden de los Starts
         inventory.SetListToChildren();
         scene.SetListToChildren();
     }
     else
     {
         introReadFocus();
     }
 }
示例#15
0
    private ScreenInput getTouchInput()
    {
        ScreenInput result = null;

        if (Input.touchCount > 0)
        {
            Touch firstTouch = Input.GetTouch(0);
            if (firstTouch.phase == TouchPhase.Began)
            {
                result            = new ScreenInput();
                result.inputPoint = Camera.main.ScreenToWorldPoint(firstTouch.position);
                result.state      = ScreenInput.State.Down;
            }
        }

        return(result);
    }
示例#16
0
        /// <summary>
        /// Constructs a block selector window.
        /// </summary>
        public BlockPlacer(Engine engine, LevelEditor parentEditor)
            : base("Block Selector")
        {
            this.parentEditor = parentEditor;

            ScreenButton _but = new ScreenButton(this, "Back", "<", engine.FontMain);

            _but.Position.X = boarderSize;
            _but.Size.X     = 32;
            ElementList.Add(_but);
            _but            = new ScreenButton(this, "Forward", ">", engine.FontMain);
            _but.Position.X = boarderSize + 32 + boarderSize;
            _but.Size.X     = 32;
            _but.Position.Y = headerSize + boarderSize;
            ElementList.Add(_but);
            _but            = new ScreenButton(this, "New Block", "New", engine.FontMain);
            _but.Position.X = boarderSize + 32 + boarderSize + 32 + boarderSize;
            _but.Size.X     = 48;
            _but.Position.Y = headerSize + boarderSize;
            ElementList.Add(_but);
            _but            = new ScreenButton(this, "Edit Block", "Edit", engine.FontMain);
            _but.Position.X = boarderSize + 32 + boarderSize + 32 + boarderSize + 48 + boarderSize;
            _but.Size.X     = 48;
            _but.Position.Y = headerSize + boarderSize;
            ElementList.Add(_but);
            _but            = new ScreenButton(this, "Save/Load", "Sv/Ld", engine.FontMain);
            _but.Position.X = boarderSize + 32 + boarderSize + 32 + boarderSize + 48 + boarderSize + 48 + boarderSize;
            _but.Size.X     = 48;
            _but.Position.Y = headerSize + boarderSize;
            ElementList.Add(_but);

            InputField = new ScreenInput(this, engine.FontMain);
            AddElement(InputField);

            PrevPosition = new Vector2((Size.X - PrevBoxWidth * PrevMaximumColumns) / 2, GetTotalElementHeight());
            this.Size.Y  = PrevPosition.Y + Screen.boarderSize + PrevMaximumRows * PrevBoxHeight;

            FilterBlocks(engine);

            this.Position = new Vector2(engine.windowSize.X - this.Size.X, 0);
        }
示例#17
0
        public LightSettings(Engine engine, LevelEditor ParentScreen)
            : base("Light Settings")
        {
            this.Size         = new Vector2(256, 256);
            this.ParentScreen = ParentScreen;

            ParentScreen.RestrictZ = false;
            AddCloseButton(engine);
            ParentScreen.StackBlocks     = false;
            ParentScreen.StackButton.Tex = engine.textureManager.Dic["stack_off_button"];
            AddText("Click in 3D space to place sun.", engine.FontMain);
            LightIntensityBox = new ScreenInput(this, engine.FontMain, "IntensityInput");
            AddElement(LightIntensityBox);
            AmbienceBox = new ScreenInput(this, engine.FontMain, "AmbienceInput");
            AddElement(AmbienceBox);
            PictureTop = this.GetTotalElementHeight();
            this.Size  = new Vector2(256, PictureTop + 256);

            LightIntensityBox.InputString = engine.primManager.myEffect.LightIntensity.ToString();
            AmbienceBox.InputString       = engine.primManager.myEffect.Ambience.ToString();
        }
示例#18
0
    //For arrow inputs
    private ScreenInput getKeyboardInput()
    {
        ScreenInput result = null;

        if (Input.GetKey(KeyCode.DownArrow))
        {
          result = new ScreenInput();
          result.inputPoint = Vector2.zero;
          result.state = ScreenInput.State.Hold;
          result.arrow = ScreenInput.Arrow.Down;
        }

        if (Input.GetKey(KeyCode.UpArrow))
        {
          result = new ScreenInput();
          result.inputPoint = Vector2.zero;
          result.state = ScreenInput.State.Hold;
          result.arrow = ScreenInput.Arrow.Up;
        }

        if (Input.GetKey(KeyCode.LeftArrow))
        {
          result = new ScreenInput();
          result.inputPoint = Vector2.zero;
          result.state = ScreenInput.State.Hold;
          result.arrow = ScreenInput.Arrow.Left;
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
          result = new ScreenInput();
          result.inputPoint = Vector2.zero;
          result.state = ScreenInput.State.Hold;
          result.arrow = ScreenInput.Arrow.Right;
        }

        return result;
    }
示例#19
0
    //For arrow inputs
    private ScreenInput getKeyboardInput()
    {
        ScreenInput result = null;

        if (Input.GetKey(KeyCode.DownArrow))
        {
            result            = new ScreenInput();
            result.inputPoint = Vector2.zero;
            result.state      = ScreenInput.State.Hold;
            result.arrow      = ScreenInput.Arrow.Down;
        }

        if (Input.GetKey(KeyCode.UpArrow))
        {
            result            = new ScreenInput();
            result.inputPoint = Vector2.zero;
            result.state      = ScreenInput.State.Hold;
            result.arrow      = ScreenInput.Arrow.Up;
        }

        if (Input.GetKey(KeyCode.LeftArrow))
        {
            result            = new ScreenInput();
            result.inputPoint = Vector2.zero;
            result.state      = ScreenInput.State.Hold;
            result.arrow      = ScreenInput.Arrow.Left;
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
            result            = new ScreenInput();
            result.inputPoint = Vector2.zero;
            result.state      = ScreenInput.State.Hold;
            result.arrow      = ScreenInput.Arrow.Right;
        }

        return(result);
    }
示例#20
0
 private void Awake()
 {
     instance = this;
     cam      = Camera.main;
 }
示例#21
0
	void Update ()
  	{
		timer_f = Time.time;
		timer_i = Mathf.FloorToInt(timer_f);
		GameObject.Find("Second").GetComponent<UILabel>().text = timer_i+"";
		if(_inputManager != null)
		{
    		input = _inputManager.GetInput();
		}
    	if(input != null)
    	{
      		Ray ray = new Ray(_camera.transform.position, input.inputPoint - _camera.transform.position);
      		RaycastHit[] hits = Physics.RaycastAll(ray, Constants.Board.raycastLength);
    	}
	}
示例#22
0
    // Update is called once per frame
    void Update()
    {
        ScreenInput input = _inputManager.GetKeyboardKey();

        MoveDirection(input);
    }
示例#23
0
 // Start is called before the first frame update
 void Start()
 {
     screenInput = ScreenInput.instance;
     currentList.ReadFocus();
 }
示例#24
0
 public void StartRecording()
 {
     // Start recording from main camera
     recorder    = new WEBMRecorder(videoWidth, videoHeight, 30);
     screenInput = new ScreenInput(recorder, Camera.main);
 }