void OnGUI() { GUILayout.BeginArea(new Rect(10, 10, 120, 170)); GUI.enabled = m_allowToSpawnShape; GUILayout.Label(m_message); if (GUILayout.Button("Spawn box")) { SpawnShape.Broadcast(ShapeType.Box); } if (GUILayout.Button("Spawn sphere")) { SpawnShape.Broadcast(ShapeType.Sphere); } GUI.enabled = true; GUILayout.Space(5); if (GUILayout.Button("Critical Message")) { CriticalMessage.Broadcast(); } m_criticalMessageSubscription.Enabled = GUILayout.Toggle(m_criticalMessageSubscription.Enabled, "Handle critical"); GUILayout.EndArea(); }
//all basic shapes can be created with this public static Vector3[] Simple(SpawnShape shape, float radius, float angleOffset = 0f, int fillerAmount = 0) { Vector3[] keyPoints = PrimaryPoints((int)shape, radius, angleOffset); //add filler return(Filler(keyPoints, fillerAmount)); }
private void Start() { for (int i = 0; i < cells.Length; i++) { cells[i] = 0; } spawner = FindObjectOfType <SpawnShape>(); }
//set values in creator to passed in patternInfo, used in Edit public void SetInfo(PatternInfo info) { transform.position = info.relativePosition; //transform.rotation = info.rotation; amountOfPoints = info.fillerAmount; radius = info.radius; angleOffset = info.angleOffset; spawnShape = info.shape; Configure(); }
private void OnValidate() { if (spawnShape != currentShape) { currentShape = spawnShape; Configure(); } if (amountOfPoints <= 0) { amountOfPoints = 1; } }
public SimpleItem[] SpawnPrefabs(SimpleItem prefab, int amount, SpawnShape shape) { switch (shape) { case SpawnShape.Line: _items = SpawnLine(prefab, amount); break; case SpawnShape.Circle: _items = SpawnCircle(prefab, amount); break; } return(_items); }