/// <summary> /// 接触したポップアップポイントに待機中のフォロワーが存在する場合はそのフォロワーを連れていく(追従させる) /// </summary> /// <param name="popup"></param> private void TakeFollower(PopupPoint popup) { if (!popup.IsExsistFollower()) { return; } // フォロワーに追従させる対象を決定する(すでにフォロワーが追従している場合は一番後ろのフォロワーを対象にする) Transform target = mTrans; int followerCount = mFollowerList.Count; if (followerCount > 0) { target = mFollowerList.Last().gameObject.GetComponent <Transform>(); } // フォロワーの追従開始 FollowerModel follower = popup.DeleverFollower(); follower.Follow(target, followerCount); // フォロワーをリストに追加し、プレイヤーとフォロワーの移動速度を再設定 mFollowerList.Add(follower); SetSpeed(); foreach (FollowerModel model in mFollowerList) { model.SetSpeed(mSpeed); } }
/// <summary> /// ポップアップポイントを指定されたステージ座標に生成 /// PopupPointの参照を保持する /// </summary> /// <param name="x"></param> /// <param name="y"></param> private void InstantiatePopup(int x, int y) { Vector3 pos = new Vector3(x * BLOCK_SIZE + BLOCK_SIZE, BLOCK_SIZE_HALF, y * -BLOCK_SIZE - BLOCK_SIZE); GameObject obj = Instantiate(prefabPopupPoint, pos, Quaternion.identity); obj.transform.parent = mTrans; PopupPoint popupPoint = obj.GetComponent <PopupPoint>(); mPopupList.Add(popupPoint); }