public StarStats CreateStar(Vector3 position, StarConfiguration config, bool isPlayable = false) { GameObject go = GameObject.Instantiate(starPrefab, position, Quaternion.identity) as GameObject; StarStats starStats = go.GetComponent <StarStats>(); if (starStats == null) { Debug.LogError("StarStats required!"); return(null); } starStats.SetConfiguration(config); ParticlesPool.Instance.GetParticles((int)(CONST.PARTICLES_COEFFICIENT * starStats.power), go.transform.position, starStats.power); if (isPlayable) { go.AddComponent(typeof(StarController)); playableStar = starStats; playableStar.SetActiveStatus(true); if (onSetPlayableStar != null) { onSetPlayableStar(starStats); } } else { go.AddComponent(typeof(StarAI)); allStar.Add(starStats); } return(starStats); }
public void CopyConfig(StarConfiguration config) { _power = config.power; _gravityAxis = config.gravityAxis; _starColor = config.starColor; _disableColor = config.disableColor; _changeSpeed = config.changeSpeed; }
public void SetConfiguration(StarConfiguration config) { starConfig.CopyConfig(config); Init(); }