void Start() { beatController = GameObject.Find("BeatController").GetComponent <BeatController>(); beatController.SetCanAttack(canPlayerAttack); playerController = GameObject.Find("Player").GetComponent <PlayerController>(); playerController.SetCanShift(canPlayerShift); scroller = GameObject.Find("RainbowSideScroller").GetComponent <ParallaxController>(); bScroller = GameObject.Find("RainbowBottomScroller").GetComponent <ParallaxController>(); startParallaxSpeed = scroller.GetComponent <ParallaxController>().speed; startTime = Time.time; visualizers = GameObject.FindGameObjectsWithTag("AudioCube"); foreach (var v in visualizers) { v.GetComponent <RandomColorAudioVisualizer>().SetColorRange(audioMinRed, audioMaxRed, audioMinGreen, audioMaxGreen, audioMinBlue, audioMaxBlue); } //Camera.main.orthographicSize = cameraSize; if (cameraSize != 12f) //TODO not this { StartCoroutine("ZoomOut"); GameObject.Find("BoundaryBox").transform.localScale = new Vector3(46f, 35f, 26f); GameObject.Find("Player").transform.Find("Spearhead").GetComponent <SpearheadController>().screenSize = 20f; } }
static List <Category> GetCategories() { if (Categories == null) { Categories = ParallaxController.GetCategories(); } return(Categories); }
void Awake() { if (Instance != null && Instance != this) { Destroy(gameObject); } Instance = this; }
// Use this for initialization void Start() { enemyGenerator = FindObjectOfType<EnemyGenerator>(); areaGenerator = FindObjectOfType<AreaGenerator>(); backgroundGenerator = FindObjectOfType<ParallaxController>(); player = FindObjectOfType<PlayerController>(); Load(levels[defaultLevelNo]); }
// Start is called before the first frame update private void Awake() { controller = GetComponent <ParallaxController>(); if (windowBounds.Value.x != 0 && windowBounds.Value.y != 0) { OnBoundsChange(Vector2.zero, windowBounds.Value); } windowBounds.OnChange += OnBoundsChange; }
public override void Trigger(GameObject Actor) { if (Actor != null) { ParallaxController pc = Actor.GetComponent <ParallaxController>(); if (pc == null) { print("No Parallax Controller"); return; } pc.ChangeBGGradually(fadeTime); } }
public override void OnInspectorGUI() { // Show default inspector property editor DrawDefaultInspector(); _parallaxCon = (ParallaxController)target; GUILayout.Label("Freeze layer when player idle:", EditorStyles.boldLabel); if (_parallaxCon.ShowFloat.Count == 0) { FillList(); } if (_parallaxCon.ShowFloat.Count != _parallaxCon.ParallaxLayers.Length) { RefreshList(); } for (int i = 0; i < _parallaxCon.ParallaxLayers.Length; i++) { HandleToggle(i); } GUILayout.Label("Set custom speed for parallax effect:", EditorStyles.boldLabel); if (_parallaxCon.ParallaxSpeeds.Count == 0) { FillFloatList(); } if (_parallaxCon.ParallaxSpeeds.Count != _parallaxCon.ParallaxLayers.Length) { RefreshFloatList(); } for (int i = 0; i < _parallaxCon.ParallaxLayers.Length; i++) { HandleFloats(i); } if (GUI.changed) { EditorUtility.SetDirty(target); } }
void SetElements(ParallaxController secondController, SpriteRenderer sprite) { //Debug.Log("SEt ELEMENTS"); switch (secondController.parallaxType) { case ParallaxType.Background: GetParallaxElements(0, sprite); break; case ParallaxType.Back: GetParallaxElements(1, sprite); break; case ParallaxType.Front: GetParallaxElements(2, sprite); break; } }
public ActionResult <IEnumerable <Checksum> > GetChecksums() { List <Checksum> checksums = new List <Checksum>(); long? product = ParallaxController.GetCheckSUMProducts(); long? inventory = ParallaxController.GetCheckSUMItems(); long? direction = ParallaxController.GetCheckSUMDirections(); if (product != null) { checksums.Add(new Checksum(Checksum.PRODUCT, product.Value)); } if (inventory != null) { checksums.Add(new Checksum(Checksum.INVENTORY, inventory.Value)); } if (direction != null) { checksums.Add(new Checksum(Checksum.DIRECTION, direction.Value)); } return(checksums); }
//Spawn players for all joined players public void spawnPlayers() { //Gather spawnpoints PopulateSpawnpoints(); //Array to tell which spawnpoints are occupied bool[] spawnsUsed = new bool[spawnPoints.Length]; int spawnIndex = 0; for (int i = 0; i < players.Count; i++) { players[i].vibrationPower = 0;//Stop vibration as a precaution //Finding a good spawnpoint spawnIndex = (int)Random.Range(0, spawnPoints.Length - 1); do { if (++spawnIndex >= spawnPoints.Length) { spawnIndex = 0; } } while (spawnsUsed[spawnIndex]); //Set spawn to used spawnsUsed[spawnIndex] = true; players[i].mainObject = (GameObject)Instantiate(playerPrefab, spawnPoints[spawnIndex].transform.position, Quaternion.identity); players[i].SetupPlayer(); } playersAlive = players.Count; GameObject backGround = GameObject.Find("Background"); if (backGround != null) { parallaxController = GameObject.Find("Background").GetComponent <ParallaxController>(); parallaxController.RoundOver(); } }
IEnumerator SmoothTransitionBG(ParallaxController par, float speed) { float difference = par.scrollSpeed - speed; //Acceleration if (difference < 0) { for (float i = par.scrollSpeed; i < speed; i += 0.01f) { par.scrollSpeed = i; yield return(new WaitForSeconds(0.01f)); } } //Deceleration else { for (float i = speed; i > par.scrollSpeed; i -= 0.01f) { par.scrollSpeed = i; yield return(new WaitForSeconds(0.01f)); } } yield return(new WaitForSeconds(0.01f)); }
void Awake() { _parallaxController = GetComponent<ParallaxController> (); }
private void Awake() { elapsedTime = 0; controller = GetComponent <ParallaxController>(); maxTime = Mathf.Max(xVelocityCurve.Duration, yVelocityCurve.Duration); }
public ActionResult <IEnumerable <InventoryShort> > GetDirections() { return(ParallaxController.GetInventories()); }
// Use this for initialization void Start() { pc = FindObjectOfType <ParallaxController>(); }
void Awake() { _parallaxController = GetComponent <ParallaxController> (); }
public ActionResult <long?> GetChecksum() { return(ParallaxController.GetCheckSUMDirections()); }
public void Link(ParallaxController owner) { _owner = owner; _transform = transform; RecalculateInnerFactor(); }
public ActionResult <IEnumerable <DirectionShort> > GetDirections() { return(ParallaxController.GetDirections()); }
public ActionResult <IEnumerable <DirectionShort> > GetValidDirections() { return(ParallaxController.GetDirections().Where(x => x.From != null && x.To != null).ToList().ConvertAll(new Converter <Direction, DirectionShort>(DirectionShort.Convert))); }
private void Awake() { controller = GetComponent <ParallaxController>(); }
private void OnEnable() { controller = (ParallaxController)target; }
private void OnAwake() { controller = (ParallaxController)target; }
public void Unlink() { _owner = null; }
public ActionResult <IEnumerable <ProductShort> > GetProducts() { return(ParallaxController.GetProducts()); }