public override void OnInspectorGUI() { var tar = (CircleSpawn)target; targetObj = tar; makeSlider("Radius", tar.radius, 0f, 10, 24, UpdateType.RADIUS); makeSlider("Number of Items", tar.numOfItems, 0f, 100, 24, UpdateType.RESPAWN); makeSlider("Angle", angleIncrement, 0f, 360, 24, UpdateType.ANGLE); //set its values tar.radius = EditorGUILayout.FloatField("Radius:", tar.radius); tar.numOfItems = EditorGUILayout.IntField("Number of Items:", tar.numOfItems); angleIncrement = EditorGUILayout.FloatField("Angle:", angleIncrement); tar.clonedObject = (GameObject)EditorGUILayout.ObjectField(tar.clonedObject, typeof(GameObject), true); //Inspector button for creating the objects in the Editor if (GUILayout.Button("Create")) { RespawnNumOfItems(); } }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); playerMovScript = player.GetComponent <PlayerMovement>(); rotateToEnemyScript = player.GetComponentInChildren <RotateToClosestEnemy>(); menuContScript = GameObject.Find("_Game Controller").GetComponent <MenuController>(); circleSpawnScript = GetComponent <CircleSpawn>(); enemySprite = GetComponentInChildren <SpriteRenderer>(); enemySprite.color = enemyColorGreen; StartCoroutine(ChangeState()); }
void Start() { spawnerScript = GameObject.Find("_Game Controller").GetComponent <EnemySpawnerSpawner>(); scoreContScript = GameObject.Find("_Game Controller").GetComponent <ScoreController>(); circleSpawnScript = GetComponent <CircleSpawn>(); audSource = GetComponent <AudioSource>(); enemySpawnWaitTime = Random.Range(8, 14); StartCoroutine(SpawnEnemy()); sr = GetComponentInChildren <SpriteRenderer>(); currentSprite = 0; }