public override bool IsConditionRespected(Vector3 rightHandRelocated, Quaternion rightHandrotationRelocated) { float dist = Vector3.Distance(m_offsetPosition, rightHandRelocated); m_lastValue = dist; return(m_lastConditionResult = MyMathf.IsBetween(dist, 0, m_appoximationMeter));; }
// Use this for initialization void Start() { string str = MyMathf.BigAdd("2334444555887739932048762732738747878738487487389478934", "849347837487878278328378748574878374738947398748394737487389" + "78473874872937827389273867473874879423829382908309437587593489028032974878347"); Debug.Log("r = " + str); Debug.Log("r =" + MyMathf.BigAdd("234", "1023")); }
public bool IsLineOfSight(Node end) { bool inSight; if (x == end.x) { int dy = MyMathf.Sign(end.y - y); if (dy == 0) { return(!tile.isBlocked); } inSight = true; for (int sy = y; sy != end.y + dy; sy += dy) { if (nodes[x, sy].tile.isBlocked) { inSight = false; break; } } return(inSight); } else if (y == end.y) { int dx = MyMathf.Sign(end.x - x); //if (dx == 0) return !tile.isBlocked; inSight = true; for (int sx = x; sx != end.x + dx; sx += dx) { if (nodes[sx, y].tile.isBlocked) { inSight = false; break; } } return(inSight); } Point4 startPoints = GetContainingPoints(); Point4 endPoints = end.GetContainingPoints(); inSight = true; for (int i = 0; i < 4; i++) { if (!startPoints[i].IsLineOfSight(endPoints[i])) { inSight = false; break; } } return(inSight); }
public virtual void ToShootOff() { Collider[] colliders = OverlapColliders(); if (colliders == null || colliders.Length <= 0) { return; } for (int i = 0; i < colliders.Length; i++) { if (colliders[i] == null || MyMathf.IsInLayerMask(colliders[i].attachedRigidbody.gameObject, colliderLayer) == false) { continue; } ToShootOff(colliders[i].attachedRigidbody); break; } }
public override bool IsConditionRespected(Vector3 rightHandRelocated, Quaternion rightHandrotationRelocated) { if (m_ignoreAxeX) { rightHandRelocated.x = 0; } if (m_ignoreAxeY) { rightHandRelocated.y = 0; } if (m_ignoreAxeZ) { rightHandRelocated.z = 0; } float dist = Vector3.Distance(Vector3.zero, rightHandRelocated); m_lastValue = dist; return(m_lastConditionResult = MyMathf.IsBetween(dist, m_distanceMeter, m_approximationMeter)); }
// Update is called once per frame void Update() { //現在の位置を0~1のfloatで取得 float justTimePos; justTimePos = (float)(Music.TimeSamples - startSample) / (float)(endSample - startSample); //座標移動 Vector3 newPos = Vector3.zero; newPos.x = MyMathf.LerpUnlimited(startPos.x, endPos.x, justTimePos); newPos.y = MyMathf.LerpUnlimited(startPos.y, endPos.y, justTimePos); transform.position = newPos; //サイズ変更 float newSize = MyMathf.LerpUnlimited(startSize, endSize, justTimePos); transform.localScale = Vector3.one * newSize; //消滅 if (Music.TimeSamples > endSample + destroyPostponedTime * Music.CurrentSource.clip.frequency) { Destroy(gameObject); } }
public override void ToShootOff() { if (isToMoveCenter) { Collider[] colliders = OverlapColliders(); if (colliders == null || colliders.Length <= 0) { return; } for (int i = 0; i < colliders.Length; i++) { if (colliders[i] == null || MyMathf.IsInLayerMask(colliders[i].attachedRigidbody.gameObject, colliderLayer) == false) { continue; } if ((triggerNum > 0 || triggerNum == -1) && !isMoveToCenter) { isMoveToCenter = true; if (veiwModel != null) { veiwModel.gameObject.SetActive(false); } colliderRigidbody = colliders[i].attachedRigidbody; colliderTrans = colliderRigidbody.transform; colliderGravity = colliderTrans.GetComponent <GenerateGravity>(); if (colliderGravity) { colliderGravity.SetIsGravity = false; } colliderRigidbody.velocity = Vector3.zero; isTrigger = true; break; } break; } } else { Collider[] colliders = OverlapColliders(); if (colliders == null || colliders.Length <= 0) { return; } for (int i = 0; i < colliders.Length; i++) { if (colliders[i] == null || MyMathf.IsInLayerMask(colliders[i].attachedRigidbody.gameObject, colliderLayer) == false) { continue; } if ((triggerNum > 0 || triggerNum == -1)) { if (veiwModel != null) { veiwModel.gameObject.SetActive(false); } ToShootOff(colliders[i].attachedRigidbody); if (SpringEvent != null) { SpringEvent?.Invoke(null); } if (triggerNum > 0) { triggerNum--; } } break; } } }
public bool IsLineOfSight(Point end) { int dfx = end.x - x; int dfy = end.y - y; bool inSight = true; if (Mathf.Abs(dfx) > Mathf.Abs(dfy)) { int dx = MyMathf.Sign(dfx); float prevY = y; for (int sx = x + dx; sx != end.x + dx; sx += dx) { float sy = y + (dfy * (sx - x)) / (float)dfx; int nx = dx > 0 ? sx - dx : sx; int ny = Mathf.Min((int)sy, (int)prevY); if (nodes[nx, ny].isBlocked) { inSight = false; break; } // Line is contained in two nodes; check another node(upper bound) if ((int)prevY != (int)sy && !MyMathf.IsInt(prevY) && !MyMathf.IsInt(sy)) { ny = Mathf.Max((int)sy, (int)prevY); if (nodes[nx, ny].isBlocked) { inSight = false; break; } } prevY = sy; } } else { int dy = MyMathf.Sign(dfy); float prevX = x; for (int sy = y + dy; sy != end.y + dy; sy += dy) { float sx = x + (dfx * (sy - y)) / (float)dfy; int ny = dy > 0 ? sy - dy : sy; int nx = Mathf.Min((int)sx, (int)prevX); if (nodes[nx, ny].isBlocked) { inSight = false; break; } if ((int)prevX != (int)sx && !MyMathf.IsInt(prevX) && !MyMathf.IsInt(sx)) { nx = Mathf.Max((int)sx, (int)prevX); if (nodes[nx, ny].isBlocked) { inSight = false; break; } } prevX = sx; } } return(inSight); }