Ejemplo n.º 1
0
 public void OnIndexSet(int index)
 {
     platformIndex   = index;
     gameObject.name = string.Format("Platform#{0}", platformIndex.ToString());
     //update the difficulty settings of the platform
     thisPlatformDifficulty = DifficultySubManager.instance.GetPlatformDifficulty(this);
     thisPlatformSpinSpeed  = DifficultySubManager.instance.GetPlatformSpinSpeed(thisPlatformDifficulty);
 }
Ejemplo n.º 2
0
 public void OnReposition(int index)
 {
     platformIndex   = index;
     gameObject.name = string.Format("Platform#{0}", platformIndex.ToString());
     //update the difficulty settings of the platform
     thisPlatformDifficulty        = DifficultySubManager.instance.GetPlatformDifficulty(this);
     thisPlatformSpinSpeed         = DifficultySubManager.instance.GetPlatformSpinSpeed(thisPlatformDifficulty);
     gameObject.transform.position = WorldSubManager.instance.platforms[WorldSubManager.instance.platforms.Count - 2].transform.position + new Vector3(0, WorldSubManager.instance.distanceAppart, 0);
     SwitchOn();
 }
Ejemplo n.º 3
0
        private void Awake()
        {
            sides = new List <Side>();

            if (thisPlatformType != WorldSubManager.PlatformTypes.Test)
            {
                thisPlatformType       = WorldSubManager.PlatformTypes.Normal;
                thisPlatformDifficulty = DifficultySubManager.instance.GetPlatformDifficulty(this);
                thisPlatformSpinSpeed  = DifficultySubManager.instance.GetPlatformSpinSpeed(thisPlatformDifficulty);
            }
            try
            {
                //If we forget to setup the prefabs, since it will be  #ofplats * 4
                if (sides.Count <= 0)
                {
                    //finds sides and sets them in the sides[]
                    for (int i = 0; i < 4; i++)
                    {
                        //naming starts at S_01--> S_04
                        sides.Add(transform.Find(string.Format("S_0{0}", (i + 1).ToString())).GetComponent <Side>());
                    }

                    //sets the side colors
                    for (int i = 0; i < sides.Count; i++)
                    {
                        if (i % 2 == 0)
                        {
                            //true, green
                            sides[i].gameObject.GetComponent <Renderer>().material = WorldSubManager.instance.plat_Y;
                            sides[i].isPassable = true;
                            if (sides[i].col.enabled)
                            {
                                sides[i].col.isTrigger = true;
                            }
                        }
                        else if (i % 2 != 0)
                        {
                            //false, red
                            sides[i].gameObject.GetComponent <Renderer>().material = WorldSubManager.instance.plat_N;
                            sides[i].isPassable = false;
                            if (sides[i].col.enabled)
                            {
                                sides[i].col.isTrigger = false;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Log("Platform.Awake(): " + ex.Message);
            }
        }