/// <summary> /// 更新 /// </summary> public override void Play() { base.Play(); MDPlayArea playArea = (Game as MDGame).PlayArea; // タッチした瞬間 if (InputManager.IsTouchDown()) { m_TouchStartPos = InputManager.GetWorldTouchPosition(); m_IgnoreAction = false; m_LineCreateWaitTime = 0; // 背景ライン演出 playArea.SetBackLineFlash(playArea.ConvertPositionToRow(m_TouchStartPos.x)); } // タッチ中 if (InputManager.IsTouch()) { // 列を更新 m_CurrentRow = playArea.ConvertPositionToRow(m_TouchStartPos.x); UpdatePosition(); // ライン作成 m_LineCreateWaitTime -= GameManager.TimeStep; if (InputManager.IsTouchDouble() && m_LineCreateWaitTime <= 0f) { m_LineCreateWaitTime = MDGame.Config.LineCreateContinueTouchTime; AddLine(); } // アクション else if (!m_IgnoreAction) { Vector2 dif = InputManager.GetWorldTouchPosition() - m_TouchStartPos; if (!m_IgnoreAction && Mathf.Abs(dif.y) > MDGame.Config.ActionStartSwipeDistance) { // 上 if (dif.y > 0 && playArea.IsValidPush()) { // プッシュ PushDrop((sbyte)m_CurrentRow); m_IgnoreAction = true; } // 下 else if (dif.y <= 0 && playArea.IsValidPull(m_CurrentRow)) { // プル PullDrop((sbyte)m_CurrentRow); m_IgnoreAction = true; } } } } // 適当に色変更 m_SpriteRenderer.color = playArea.GetPulledDrop(0) == null ? Color.white : playArea.GetPulledDrop(0).SpriteColor; }
public GameObject PlayAreaTemplate; // TODO: AssetBundle /// <summary> /// 初期化 /// </summary> public override void Initialize(PlayerController pc) { base.Initialize(pc); Player = Instantiate(PlayerTemplate).GetComponent <MDPlayer>(); PlayArea = Instantiate(PlayAreaTemplate).GetComponent <MDPlayArea>(); PlayArea.transform.SetParent(GameObject.Find(Controller.isLocalPlayer ? "PlayArea" : "EnemyPlayArea").transform, false); Player.Initialize(this); PlayArea.Initialize(this); }
/// <summary> /// 初期化 /// </summary> public void Initialize(MDPlayArea area) { gameObject.SetActive(true); m_Area = area; m_State = State.None; m_Type = (Type)area.Game.Controller.SyncRand.Next((int)Type.Red, (int)Type.Frozen + 1); IsValidVanish = false; IsPushed = false; IsMatchPushed = false; m_SpriteRenderer.enabled = true; SetMaterial(m_Type); }