private void Awake() { current = this; inactiveDict.Add(AsteroidSize.big, new List <Asteroid>()); inactiveDict.Add(AsteroidSize.medium, new List <Asteroid>()); inactiveDict.Add(AsteroidSize.small, new List <Asteroid>()); inactiveDict.Add(AsteroidSize.tiny, new List <Asteroid>()); }
/// <summary> /// Initialize Bullet's initial value /// </summary> /// <param name="accelerationRate"></param> /// <param name="direction"></param> /// <param name="velocity"></param> /// <param name="parentTransform"></param> internal void Init( float accelerationRate, Vector3 direction, Vector3 velocity, Transform parentTransform, AsteroidSystem asteroidSystemInstance ) { this.accelerationRate = accelerationRate; this.direction = direction; this.velocity = velocity; transform.SetParent(parentTransform); this.asteroidSystemInstance = asteroidSystemInstance; }
/// <summary> /// Initialize Asteroid's initial value /// </summary> /// <param name="accelerationRate"></param> /// <param name="maxSpeed"></param> /// <param name="direction"></param> /// <param name="parentSystem"></param> /// <param name="playerCollider"></param> /// <param name="parentTransform"></param> public void Init( float accelerationRate, float maxSpeed, Vector3 direction, AsteroidSystem parentSystem, DeathStarCollider playerCollider, Transform parentTransform ) { this.accelerationRate = accelerationRate; this.maxSpeed = maxSpeed; this.direction = direction; this.parentSystem = parentSystem; this.playerCollider = playerCollider; transform.SetParent(parentTransform); }
public static void Inspector(AsteroidSystem p) { GuiTools.DrawTitleChapter("Asteroid",12,true,0,Screen.width,Color.white); // Add if (GUILayout.Button(new GUIContent(" Add asteroid field",CosmosInspector.GetIcon(13)))){ Asteroid a = AddAsteroid(); SelectAsteroid( a); } // Random planet if (GUILayout.Button(new GUIContent(" Random Asteroid",CosmosInspector.GetIcon(20)))){ RandomAsteroid(); } GuiTools.DrawSeparatorLine(); // Toolbar Texture2D[] toolBarIcons = new Texture2D[3]; toolBarIcons[0] = CosmosInspector.GetIcon(30); toolBarIcons[1] = CosmosInspector.GetIcon(27); // Move toolBarIcons[2] = CosmosInspector.GetIcon(28); // Rotate toolIndex = GUILayout.SelectionGrid( toolIndex, toolBarIcons,3); EditorGUILayout.Space(); Asteroid[] asts = p.GetComponentsInChildren<Asteroid>(); int i=0; while (i<asts.Length){ AsteroidProperties( asts[i]); i++; } asts = PlanetSystem.instance.transform.GetComponentsInChildren<Asteroid>(); i=0; while (i<asts.Length){ AsteroidProperties( asts[i]); i++; } GuiTools.DrawSeparatorLine(); if (GUILayout.Button( new GUIContent( " Clear",CosmosInspector.GetIcon(12)))){ if (EditorUtility.DisplayDialog( "Clear all asteroids","Are you sure ?","Delete","Cancel")){ p.ClearAsteroids(); } } }