//ターゲット取得 protected override Vector2 GetTarget(InputStatus input) { Vector2 direction = input.GetStartPoint() - input.GetEndPoint(); Vector2 target = direction + Common.FUNC.ParseVector2(myTran.position); return(target); }
//目標ポイント取得 protected virtual Vector2 GetTarget(InputStatus input) { Vector2 target = input.GetPoint(); if (isDrag) { Vector2 direction = input.GetStartPoint() - input.GetEndPoint(); target = direction + Common.FUNC.ParseVector2(myTran.position); } return(target); }
//発射 public override GameObject Fire(InputStatus input) { index++; if (totalLimit > 0) { objList.RemoveAll(o => o == null); } LineRendererStatus lineStatus = new LineRendererStatus(input.linePositions); StartCoroutine(ContinuousSpawn(input.GetStartPoint(), lineStatus.GetEvenlySpacedPoints(maxCount, perLength))); return(null); }
//発射 public override GameObject Fire(InputStatus input) { Vector2 start = input.GetStartPoint(); Vector2 end = input.GetEndPoint(); float borderAngleAbs = Mathf.Abs(borderAngle); float dx = end.x - start.x; float dy = end.y - start.y; float rad = Mathf.Atan2(dy, dx); float angle = rad * Mathf.Rad2Deg; GameObject obj = null; if (Mathf.Abs(angle) <= borderAngleAbs || 180 - Mathf.Abs(angle) <= borderAngleAbs) { if (frontWeaponCtrl != null) { obj = frontWeaponCtrl.Fire(input); } } else { if ((angle > 0 && !isDrag) || (angle < 0 && isDrag)) { if (upwardWeaponCtrl != null) { obj = upwardWeaponCtrl.Fire(input); } } else { if (underWeaponCtrl != null) { obj = underWeaponCtrl.Fire(input); } } } return(obj); }
//発射 public override GameObject Fire(InputStatus input) { index++; UseMp(); Vector2 startPoint = input.GetStartPoint(); Vector2 endPoint = input.GetEndPoint(); Vector2 spawnPoint = (startPoint + endPoint) / 2; float length = (startPoint - endPoint).magnitude; if (length > maxLength) { length = maxLength; } else if (length < minLength) { length = minLength; } Quaternion q = Quaternion.LookRotation(Vector3.back, startPoint - endPoint); GameObject obj = Spawn(spawn, spawnPoint, q); obj.transform.localScale = new Vector2(1, length); return(obj); }