Пример #1
0
    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;
        }
    }
Пример #2
0
 static List <Category> GetCategories()
 {
     if (Categories == null)
     {
         Categories = ParallaxController.GetCategories();
     }
     return(Categories);
 }
Пример #3
0
    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]);
    }
Пример #5
0
        // 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);
     }
 }
Пример #7
0
    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);
        }
    }
Пример #8
0
    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;
        }
    }
Пример #9
0
        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);
        }
Пример #10
0
    //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();
        }
    }
Пример #11
0
    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));
    }
Пример #12
0
	void Awake()
	{
		_parallaxController = GetComponent<ParallaxController> ();
	}
Пример #13
0
 private void Awake()
 {
     elapsedTime = 0;
     controller  = GetComponent <ParallaxController>();
     maxTime     = Mathf.Max(xVelocityCurve.Duration, yVelocityCurve.Duration);
 }
Пример #14
0
 public ActionResult <IEnumerable <InventoryShort> > GetDirections()
 {
     return(ParallaxController.GetInventories());
 }
Пример #15
0
 // Use this for initialization
 void Start()
 {
     pc = FindObjectOfType <ParallaxController>();
 }
Пример #16
0
 void Awake()
 {
     _parallaxController = GetComponent <ParallaxController> ();
 }
Пример #17
0
 public ActionResult <long?> GetChecksum()
 {
     return(ParallaxController.GetCheckSUMDirections());
 }
Пример #18
0
 public void Link(ParallaxController owner)
 {
     _owner     = owner;
     _transform = transform;
     RecalculateInnerFactor();
 }
Пример #19
0
 public ActionResult <IEnumerable <DirectionShort> > GetDirections()
 {
     return(ParallaxController.GetDirections());
 }
Пример #20
0
 public ActionResult <IEnumerable <DirectionShort> > GetValidDirections()
 {
     return(ParallaxController.GetDirections().Where(x => x.From != null && x.To != null).ToList().ConvertAll(new Converter <Direction, DirectionShort>(DirectionShort.Convert)));
 }
Пример #21
0
 private void Awake()
 {
     controller = GetComponent <ParallaxController>();
 }
Пример #22
0
 private void OnEnable()
 {
     controller = (ParallaxController)target;
 }
Пример #23
0
 private void OnAwake()
 {
     controller = (ParallaxController)target;
 }
Пример #24
0
 public void Unlink()
 {
     _owner = null;
 }
Пример #25
0
 public ActionResult <IEnumerable <ProductShort> > GetProducts()
 {
     return(ParallaxController.GetProducts());
 }