コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow))
     {
         if (Input.GetKeyDown(KeyCode.RightArrow) && currentList < lists.Count - 1)
         {
             currentList++;
         }
         else if (Input.GetKeyDown(KeyCode.LeftArrow) && currentList > 0)
         {
             currentList--;
         }
         else if (Input.GetKeyDown(KeyCode.DownArrow) && currentIndex < lists[currentList].Count - 1)
         {
             currentIndex++;
         }
         else if (Input.GetKeyDown(KeyCode.UpArrow) && currentIndex > 0)
         {
             currentIndex--;
         }
         pickedOption = lists[currentList][currentIndex];
         MoveIndicator(currentList, currentIndex);
     }
     if (Input.GetKeyDown(KeyCode.Return))
     {
         menuController.GetComponent <MenuController>().ChangeMenu(pickedOption);
     }
 }
コード例 #2
0
 // Start is called before the first frame update
 void Start()
 {
     instance  = this;
     indicator = this.gameObject;
     indpos    = indicator.transform.position;
     LeftCategories.Add(MenuController.Category.Attack);
     LeftCategories.Add(MenuController.Category.Items);
     RightCategories.Add(MenuController.Category.Spells);
     RightCategories.Add(MenuController.Category.Run);
     lists.Add(LeftCategories);
     lists.Add(RightCategories);
     currentList  = 0;
     currentIndex = 0;
     pickedOption = lists[currentList][currentIndex];
 }