private void Start() { player = GameObject.Find("Player"); UB_up = up.GetComponent <UIBottun>(); UB_down = down.GetComponent <UIBottun>(); UB_right = right.GetComponent <UIBottun>(); UB_left = left.GetComponent <UIBottun>(); UB_summon = GetComponent <UIBottun>(); }
// Start is called before the first frame update void Awake() { CC = GameObject.Find("Main Camera").GetComponent <CameraController>(); PC = GetComponent <PlayerController>(); MEM = GameObject.Find("MovieEventMaster").GetComponent <MovieEventMaster>(); rb = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); Transform dodai = GameObject.Find("PlayerUI").transform.Find("dodai"); UB_up = dodai.Find("upButton").GetComponent <UIBottun>(); UB_down = dodai.Find("downButton").GetComponent <UIBottun>(); UB_left = dodai.Find("leftButton").GetComponent <UIBottun>(); UB_right = dodai.Find("rightButton").GetComponent <UIBottun>(); UB_sword = dodai.Find("SwordButton").GetComponent <UIBottun>(); UB_magic = dodai.Find("MagicButton").GetComponent <UIBottun>(); UB_gun = dodai.Find("GunButton").GetComponent <UIBottun>(); UB_move = dodai.Find("MoveButton").GetComponent <UIBottun>(); isPressed = false; isreroad = true; }
public override void GetInputKey() { key = 0; isDoubleJump = false; if (Input.GetKey(KeyCode.RightArrow) || UB_right.GetIsPressed()) //右 { key = 1; } if (Input.GetKey(KeyCode.LeftArrow) || UB_left.GetIsPressed()) //左 { key = -1; } if ((Input.GetKeyDown(KeyCode.Space) || UB_move.GetIsPressedDown()) && (!animator.GetBool("isGround")) && (state != "DJUMP"))//ジャンプボタン { isDoubleJump = true; } if (key != 0) { drec = key; } isDublePress = false; if ((Input.GetKeyDown(pressedKey) || UB_clone.GetIsPressedDown()) && pressedTime < 0.5f && isPress) { isDublePress = true; isPress = false; pressedTime = 0; } else if (Input.GetKeyDown(KeyCode.DownArrow) || UB_down.GetIsPressedDown() || Input.GetKeyDown(KeyCode.RightArrow) || UB_right.GetIsPressedDown() || Input.GetKeyDown(KeyCode.LeftArrow) || UB_left.GetIsPressedDown()) { if (UB_up.GetIsPressed()) { UB_clone = UB_up; isPress = true; } else if (UB_down.GetIsPressed()) { UB_clone = UB_down; isPress = true; } else if (UB_left.GetIsPressed()) { UB_clone = UB_left; isPress = true; } else if (UB_right.GetIsPressed()) { UB_clone = UB_right; isPress = true; } else { foreach (KeyCode code in Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyDown(code)) { pressedKey = code; isPress = true; } } } pressedTime = 0; } if (isPress) { pressedTime += Time.deltaTime; } }
void Start() { UB_clone = new UIBottun(); rb.sleepMode = RigidbodySleepMode2D.NeverSleep; animator.SetBool("isGround", true); }