Blue









How do I use Blue
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PickupDemoGui.cs Copy
15     public void OnGUI()
16     {
17         if (!PhotonNetwork.inRoom)
18         {
19             return;
20         }
21
22
23         if (this.ShowScores)
24         {
25             GUILayout.Label("Your Score: " + PhotonNetwork.player.GetScore());
26         }
27
28
29         if (this.ShowDropButton)
30         {
31             foreach (PickupItem item in PickupItem.DisabledPickupItems)
32             {
33                 if (item.PickupIsMine && item.SecondsBeforeRespawn <= 0)
34                 {
35                     if (GUILayout.Button("Drop " + item.name))
36                     {
37                         item.Drop(); // drops the item at the place where it originates
38                     }
39
40                     GameObject playerCharGo = PhotonNetwork.player.TagObject as GameObject;
41                     if (playerCharGo != null && GUILayout.Button("Drop here " + item.name))
42                     {
43                         // drop the item at some other place. next to the user's character would be fine...
44                         Vector3 random = Random.insideUnitSphere;
45                         random.y = 0;
46                         random = random.normalized;
47                         Vector3 itempos = playerCharGo.transform.position + this.DropOffset * random;
48
49                         item.Drop(itempos);
50                     }
51                 }
52             }
53         }
54
55
56         if (this.ShowTeams)
57         {
58             foreach (var teamName in PunTeams.PlayersPerTeam.Keys)
59             {
60                 GUILayout.Label("Team: " + teamName.ToString());
61                 List teamPlayers = PunTeams.PlayersPerTeam[teamName];
62                 foreach (PhotonPlayer player in teamPlayers)
63                 {
64                     GUILayout.Label(" " + player.ToStringFull() + " Score: " + player.GetScore());
65                 }
66             }
67
68             if (GUILayout.Button("to red"))
69             {
70                 PhotonNetwork.player.SetTeam(PunTeams.Team.red);
71             }
72             if (GUILayout.Button("to blue"))
73             {
74                 PhotonNetwork.player.SetTeam(PunTeams.Team.blue);
75             }
76         }
77     }
File name: PunTeams.cs Copy
18     public enum Team : byte {none, red, blue};
File name: Animal.cs Copy
182         public void changeToState(string state_key)
183         {
184             Animator animator = gameObject.GetComponent();
185             switch (state_key)
186             {
187                 case STATE_RUN:
188                     animator.Play("run" + (animalIndex == 0 ? "" : "_blue"));
189                     /*
190                     animator.SetBool(STATE_SHOCK, false);
191                     animator.SetBool(STATE_FIRE, false);
192                     animator.SetBool(STATE_RUN, true);
193                     animator.SetBool(IS_PLAYER, animalIndex == 0);
194                      * */
195                     break;
196                 case STATE_SHOCK:
197                     animator.Play("run_choang" + (animalIndex == 0 ? "" : "_blue"));
198                     /*
199                     animator.SetBool(STATE_SHOCK, true);
200                     animator.SetBool(STATE_FIRE, false);
201                     animator.SetBool(STATE_RUN, false);
202                      * */
203                     break;
204                 case STATE_FIRE:
205                     animator.Play("run_black");
206                     /*
207                     animator.SetBool(STATE_SHOCK, false);
208                     animator.SetBool(STATE_FIRE, true);
209                     animator.SetBool(STATE_RUN, false);
210                      * */
211                     break;
212             }
213         }
File name: Animals.cs Copy
14         public void Start()
15         {
16             string[] names = new string[] { "dog", "monkey", "pig", "fox", "giraffe", "panda", "rhino", "tiger", "elephant", "lion" };
17
18             animals = new List();
19             int animalIndex = 0;
20
21             UpgradeInfo upgradeInfo = new UpgradeInfo();
22
23             GameObject animalPlayer = (GameObject)Instantiate(Resources.Load("Animals/" + names[Attr.currentAnimal]));
24             animalPlayer.transform.parent = gameObject.transform;
25             animalPlayer.transform.localPosition = new Vector3(-3.5f + 0.7f * animalIndex, -0.9f, 0);
26             setSortingLayer(animalPlayer, "Animal8");
27             Animal player = animalPlayer.AddComponent();
28             player.setAnimalName(names[Attr.currentAnimal]);
29             player.animalIndex = animalIndex;
30             player.gameScreen = gameScreen;
31             float speedPlayer = upgradeInfo.getItem(Attr.currentAnimal, 0, false);
32             float jumpPlayer = upgradeInfo.getItem(Attr.currentAnimal, 1, false);
33             player.setAnimalProperties(speedPlayer, jumpPlayer);
34             animalPlayer.layer = LayerMask.NameToLayer("Animal1");
35
36             animals.Add(animalPlayer);
37             animalIndex++;
38
39             animalPlayer.GetComponent().Play("run");
40             //animalPlayer.GetComponent().SetBool(Animal.IS_PLAYER, true);
41
42             TextAsset xml = Resources.Load("Levels/WorldMap" + (Attr.currentWorld + 1));
43             XmlDocument xmlDoc = new XmlDocument();
44             xmlDoc.Load(new StringReader(xml.text));
45
46             XmlNodeList xmlNodeList = xmlDoc.DocumentElement.ChildNodes;
47             XmlNodeList levelNodeList = xmlNodeList.Item(Attr.currentLevel).ChildNodes;
48             for (int i = 0; i < levelNodeList.Count; i++)
49             {
50                 int numberAnimal = int.Parse(levelNodeList.Item(i).Attributes.Item(0).Value);
51                 string animalName = levelNodeList.Item(i).Attributes.Item(1).Value.ToLower();
52
53                 for (int k = 0; k < numberAnimal; k++)
54                 {
55                     GameObject animalObject = (GameObject)Instantiate(Resources.Load("Animals/" + animalName));
56                     animalObject.transform.parent = gameObject.transform;
57                     animalObject.transform.localPosition = new Vector3(-3.5f + 0.7f*animalIndex, -0.9f, 0);
58                     setSortingLayer(animalObject, "Animal" + animalIndex);
59                     Animal animal = animalObject.AddComponent();
60                     animal.setAnimalName(animalName.ToLower() + "_blue");
61                     animal.animalIndex = animalIndex;
62                     animal.gameScreen = gameScreen;
63                     float speed = upgradeInfo.getSpeed(i);
64                     float jump = upgradeInfo.getJump(i);
65                     animal.setAnimalProperties(speed, jump);
66                     animalObject.layer = LayerMask.NameToLayer("Animal" + (animalIndex + 1));
67                     animals.Add(animalObject);
68                     animalIndex++;
69
70                     animalObject.GetComponent().Play("run_blue");
71
72                     //animalObject.GetComponent().SetBool(Animal.IS_PLAYER, false);
73                 }
74             }
75         }
File name: ActionColorTo.cs Copy
16     public ActionColorTo(Color color, float duration, Interpolation interpolation) {
17         endRed = color.r;
18         endGreen = color.g;
19         endBlue = color.b;
20         endAlpha = color.a;
21         SetDuration(duration);
22         SetInterpolation(interpolation);
23     }
File name: ActionColorTo.cs Copy
24     public ActionColorTo(float r, float g, float b, float duration, Interpolation interpolation) {
25         endRed = r;
26         endGreen = g;
27         endBlue = b;
28         endAlpha = 1;
29         SetDuration(duration);
30         SetInterpolation(interpolation);
31     }
File name: ActionColorTo.cs Copy
32     public ActionColorTo(float r, float g, float b, float a, float duration, Interpolation interpolation) {
33         endRed = r;
34         endGreen = g;
35         endBlue = b;
36         endAlpha = a;
37         SetDuration(duration);
38         SetInterpolation(interpolation);
39     }
File name: ActionColorTo.cs Copy
40     public ActionColorTo(Color color, float duration)
41     {
42         endRed = color.r;
43         endGreen = color.g;
44         endBlue = color.b;
45         endAlpha = color.a;
46         SetDuration(duration);
47     }
File name: ActionColorTo.cs Copy
48     public ActionColorTo(float r, float g, float b, float duration)
49     {
50         endRed = r;
51         endGreen = g;
52         endBlue = b;
53         endAlpha = 1;
54         SetDuration(duration);
55     }
File name: ActionColorTo.cs Copy
56     public ActionColorTo(float r, float g, float b, float a, float duration)
57     {
58         endRed = r;
59         endGreen = g;
60         endBlue = b;
61         endAlpha = a;
62         SetDuration(duration);
63     }

Download file with original file name:Blue

Blue 114 lượt xem

Gõ tìm kiếm nhanh...