예제 #1
0
        void Awake()
        {
            goldStar          = null;
            IsForceSpawnHouse = false;
            for (int i = 0; i < 10; i++)
            {
                int        wayType = Random.Range(0, 4);
                GameObject objR    = GameObject.Instantiate(SideWayPrefabs) as GameObject;
                objR.transform.parent        = this.transform;
                objR.transform.localPosition = new Vector2(2.88f, i * -ObjectLength);
                GameObject objL = GameObject.Instantiate(SideWayPrefabs) as GameObject;
                objL.transform.parent        = this.transform;
                objL.transform.localPosition = new Vector2(-2.88f, i * -ObjectLength);
                objL.transform.localScale    = new Vector2(-1, 1);
                switch (wayType)
                {
                case 0:
                {
                    //forest both
                    objR.GetComponent <SideRodeObject>().SetSidewayObject(SideWayForestList[Random.Range(0, SideWayForestList.Length)]);
                    objL.GetComponent <SideRodeObject>().SetSidewayObject(SideWayForestList[Random.Range(0, SideWayForestList.Length)]);
                } break;

                case 1:
                {
                    //left house forest right
                    objR.GetComponent <SideRodeObject>().SetSidewayObject(SideWayForestList[Random.Range(0, SideWayForestList.Length)]);
                    objL.GetComponent <SideRodeObject>().SetSidewayObject(SideWayHouseList[Random.Range(0, SideWayHouseList.Length)]);
                } break;

                case 2:
                {
                    //right house forest left
                    objR.GetComponent <SideRodeObject>().SetSidewayObject(SideWayHouseList[Random.Range(0, SideWayHouseList.Length)]);
                    objL.GetComponent <SideRodeObject>().SetSidewayObject(SideWayForestList[Random.Range(0, SideWayForestList.Length)]);
                } break;

                case 3:
                {
                    //both house
                    objR.GetComponent <SideRodeObject>().SetSidewayObject(SideWayHouseList[Random.Range(0, SideWayHouseList.Length)]);
                    objL.GetComponent <SideRodeObject>().SetSidewayObject(SideWayHouseList[Random.Range(0, SideWayHouseList.Length)]);
                } break;
                }
            }
        }
예제 #2
0
        void SpawnGoldStar(ItemCD item)
        {
            TurtleLvling lvling = Game4_LvlingStat.GetLvling();

            //spawn GoldStar

            GameObject         obj   = GameObject.Instantiate(GoldStarPrefabs) as GameObject;
            GoldStarItemObject gItem = obj.GetComponent <GoldStarItemObject>();

            obj.SetActive(true);
            obj.transform.position = new Vector3(-1.25f + Random.Range(0, 3) * 1.25f, 6, 0);
            obj.transform.parent   = rootParent.transform;
            gItem.SetGoldStar(Random.Range(2.0f, 4.0f));
            //Delayed other type cooldown]
            for (int i = 0; i < obsCount; i++)
            {
                obsList[i].Delayed(2.0f);
            }
            starItem.Delayed(2.0f);
            boosterItem.Delayed(2.0f);
            //reset item CD
            item.SetCooldown(Random.Range(lvling.GoldStarLength / 100.0f, lvling.GoldStarLength * lvling.RandomNoise / 100.0f));
        }
예제 #3
0
 public void SetThrowStar(GoldStarItemObject star)
 {
     starLock = star;
     starLock.transform.position = this.transform.position;
     Debug.Log("Gold Star Position Start = " + starLock.transform.position.x);
 }
예제 #4
0
        // Update is called once per frame
        void FixedUpdate()
        {
            if (Game4Global.GlobalPause)
            {
                return;
            }
            TravelLength += TurtleCharacter.currentSpeed / 60.0f;
            if (TravelLength > ObjectLength)
            {
                int wayType = Random.Range(0, 4);
                if (IsForceSpawnHouse)
                {
                    IsForceSpawnHouse = false;
                    wayType           = Random.Range(1, 4);
                    Debug.Log("way Type = " + wayType);
                }

                TravelLength -= ObjectLength;
                GameObject objR = GameObject.Instantiate(SideWayPrefabs) as GameObject;
                objR.transform.parent        = this.transform;
                objR.transform.localPosition = new Vector2(2.88f, -TravelLength);
                GameObject objL = GameObject.Instantiate(SideWayPrefabs) as GameObject;
                objL.transform.parent        = this.transform;
                objL.transform.localPosition = new Vector2(-2.88f, -TravelLength);
                objL.transform.localScale    = new Vector2(-1, 1);

                switch (wayType)
                {
                case 0:
                {
                    //forest both
                    objR.GetComponent <SideRodeObject>().SetSidewayObject(SideWayForestList[Random.Range(0, SideWayForestList.Length)]);
                    objL.GetComponent <SideRodeObject>().SetSidewayObject(SideWayForestList[Random.Range(0, SideWayForestList.Length)]);
                } break;

                case 1:
                {
                    //left house forest right
                    objR.GetComponent <SideRodeObject>().SetSidewayObject(SideWayForestList[Random.Range(0, SideWayForestList.Length)]);
                    objL.GetComponent <SideRodeObject>().SetSidewayObject(SideWayHouseList[Random.Range(0, SideWayHouseList.Length)]);
                    if (goldStar != null)
                    {
                        objL.GetComponent <SideRodeObject>().SetThrowStar(goldStar);
                        goldStar = null;
                    }
                } break;

                case 2:
                {
                    //right house forest left
                    objR.GetComponent <SideRodeObject>().SetSidewayObject(SideWayHouseList[Random.Range(0, SideWayHouseList.Length)]);
                    objL.GetComponent <SideRodeObject>().SetSidewayObject(SideWayForestList[Random.Range(0, SideWayForestList.Length)]);
                    if (goldStar != null)
                    {
                        objR.GetComponent <SideRodeObject>().SetThrowStar(goldStar);
                        goldStar = null;
                    }
                } break;

                case 3:
                {
                    //both house
                    objR.GetComponent <SideRodeObject>().SetSidewayObject(SideWayHouseList[Random.Range(0, SideWayHouseList.Length)]);
                    objL.GetComponent <SideRodeObject>().SetSidewayObject(SideWayHouseList[Random.Range(0, SideWayHouseList.Length)]);
                    //random choose objLR
                    if (goldStar != null)
                    {
                        bool side = Random.Range(0, 100) < 50;
                        if (side)
                        {
                            objL.GetComponent <SideRodeObject>().SetThrowStar(goldStar);
                        }
                        else
                        {
                            objR.GetComponent <SideRodeObject>().SetThrowStar(goldStar);
                        }
                        goldStar = null;
                    }
                } break;
                }
            }
        }
예제 #5
0
 public void ForceSpawnHouse(GoldStarItemObject star)
 {
     IsForceSpawnHouse = true;
     goldStar          = star;
 }
예제 #6
0
 public void Clear()
 {
     goldStar = null;
 }
예제 #7
0
 public static void ForceSpawnHouse(GoldStarItemObject item)
 {
     pGlobal.sideSpawn.ForceSpawnHouse(item);
 }