void SpawnFriendSlot() { Vector3 startPos = Vector3.zero; float radiusX = GlobalSpiralMaster.GetCurrentRadius(0f, ref GlobalSpiralMaster.RadiusMapX); float radiusY = GlobalSpiralMaster.GetCurrentRadius(0f, ref GlobalSpiralMaster.RadiusMapY); SpiralMath.GetPositionAt(0f, ref startPos, radiusX, radiusY, GlobalSpiralMaster.ScaleZ, GlobalSpiralMaster.NoiseOn); startPos += GlobalSpiralMaster.transform.position; FriendSlot friendSlot = GlobalGameState.UIPoolManager.GetPoolableObject() as FriendSlot; if (friendSlot == null) { Debug.LogError("FAILED: Getting poolable friend slot object."); return; } // Init the slot if (_playerID < 0) // temp fix for TGC iPhone demo to make it circular access { _playerID = 0; } friendSlot.Activate(); friendSlot.Init(ref startPos, 0f, PlayersJSON.Players[_playerID].NetworkMode, PlayersJSON.Players[_playerID].Name); _friendSlots.Add(friendSlot); _playerID++; }
private Vector3 GetTargetPosition() { if (CurrentSlotMode == SocialDataType.SlotMode.Selected) { float radiusX = GlobalSpiralMaster.GetCurrentRadius(GlobalFriendListManager.SelectedTValue, ref GlobalSpiralMaster.RadiusMapX); float radiusY = GlobalSpiralMaster.GetCurrentRadius(GlobalFriendListManager.SelectedTValue, ref GlobalSpiralMaster.RadiusMapY); SpiralMath.GetPositionAt(GlobalFriendListManager.SelectedTValue, ref _positionOnCurve, radiusX, radiusY, GlobalSpiralMaster.ScaleZ, GlobalSpiralMaster.NoiseOn); return(_positionOnCurve + GlobalSpiralMaster.transform.position); } else { float radiusX = GlobalSpiralMaster.GetCurrentRadius(t, ref GlobalSpiralMaster.RadiusMapX); float radiusY = GlobalSpiralMaster.GetCurrentRadius(t, ref GlobalSpiralMaster.RadiusMapY); SpiralMath.GetPositionAt(t, ref _positionOnCurve, radiusX, radiusY, GlobalSpiralMaster.ScaleZ, GlobalSpiralMaster.NoiseOn); return(_positionOnCurve + GlobalSpiralMaster.transform.position); } }
void CreateSpiral() { Positions.Clear(); float accumulatedLength = 0f; while (accumulatedLength < Length) { Vector3 pos = new Vector3(); float radiusX = GetCurrentRadius(accumulatedLength, ref RadiusMapX); float radiusY = GetCurrentRadius(accumulatedLength, ref RadiusMapY); SpiralMath.GetPositionAt(accumulatedLength, ref pos, radiusX, radiusY, ScaleZ, NoiseOn); Positions.Add(pos + gameObject.transform.position); accumulatedLength += SegmentLength; } }