void SetButton(ref PadScan padScan, int playerNo) { var ButtonNum = Settings.Instance.Common.ButtonCount; for (int i = 0; i < ButtonNum; i++) { var isPush = Input.GetButtonDown(ButtonTypeName[i][playerNo]); var isPress = Input.GetButton(ButtonTypeName[i][playerNo]); var isPop = Input.GetButtonUp(ButtonTypeName[i][playerNo]); switch ((EnumUnityButtonType)i) { case EnumUnityButtonType.Fire1: padScan.m_buttonA.SetButtonData(isPush, isPress, isPop, Time.time); break; case EnumUnityButtonType.Fire2: padScan.m_buttonB.SetButtonData(isPush, isPress, isPop, Time.time); break; case EnumUnityButtonType.Fire3: padScan.m_buttonX.SetButtonData(isPush, isPress, isPop, Time.time); break; case EnumUnityButtonType.Fire4: padScan.m_buttonY.SetButtonData(isPush, isPress, isPop, Time.time); break; } // if (isPush) // Debug.Log(i); } }
void SetCross(ref PadScan padScan, int playerNo) { var nowAxis = new Vector2(Input.GetAxis(HorizontalName[playerNo]), Input.GetAxis(VerticalName[playerNo])); padScan.SetCross(nowAxis, Time.time); // if (nowAxis != Vector2.zero) // Debug.Log(nowAxis); }
public static Entity CreateEntity(int i, EntityManager entityManager) { var archetype = entityManager.CreateArchetype(ComponentTypes.CharaComponentType); var entity = entityManager.CreateEntity(archetype); // 必要なキャラのみインプットをつける if (i < Settings.Instance.Common.PlayerCount) { entityManager.AddComponent(entity, ComponentType.ReadWrite <PadScan>()); var padScan = new PadScan(); padScan.Init(); entityManager.SetComponentData(entity, padScan); } // ID entityManager.SetComponentData(entity, new CharaId { m_myId = i, }); entityManager.SetComponentData(entity, new Translation { }); var charaPos = new CharaPos(); charaPos.SetPosition(new Vector3Int(16 << 8, 16 << 8, 8 << 8)); entityManager.SetComponentData(entity, charaPos); entityManager.SetComponentData(entity, new CharaLastPos { }); entityManager.SetComponentData(entity, new CharaDelta { }); entityManager.SetComponentData(entity, new CharaMotion { m_motionType = EnumMotionType.Idle }); entityManager.SetComponentData(entity, new CharaLook { m_isLeft = false, }); entityManager.SetComponentData(entity, new CharaFlag { m_inputCheckFlag = FlagInputCheck.Jump | FlagInputCheck.Dash | FlagInputCheck.Walk, m_moveFlag = FlagMove.Stop, m_motionFlag = FlagMotion.None, m_mukiFlag = true, }); entityManager.SetComponentData(entity, new CharaDash { m_dashMuki = EnumMuki.None }); entityManager.SetComponentData(entity, new CharaMuki { m_muki = EnumMuki.Right }); return(entity); }