AddLine









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

Featured Snippets


File name: WorkerInGame.cs Copy
34     public void OnMasterClientSwitched(PhotonPlayer player)
35     {
36         Debug.Log("OnMasterClientSwitched: " + player);
37
38         string message;
39         InRoomChat chatComponent = GetComponent(); // if we find a InRoomChat component, we print out a short message
40
41         if (chatComponent != null)
42         {
43             // to check if this client is the new master...
44             if (player.isLocal)
45             {
46                 message = "You are Master Client now.";
47             }
48             else
49             {
50                 message = player.name + " is Master Client now.";
51             }
52
53
54             chatComponent.AddLine(message); // the Chat method is a RPC. as we don't want to send an RPC and neither create a PhotonMessageInfo, lets call AddLine()
55         }
56     }
File name: InRoomChat.cs Copy
91     public void AddLine(string newLine)
92     {
93         this.messages.Add(newLine);
94     }
File name: AnimationCurveUtils.cs Copy
127         public static void AddLinearKey(this AnimationCurve curve, Keyframe keyframe)
128         {
129             var keys = curve.keys;
130             //Second or later keyframe - make the slopes linear
131             if (keys.Length > 0)
132             {
133                 var lastFrame = keys[keys.Length - 1];
134                 float slope = (keyframe.value - lastFrame.value) / (keyframe.time - lastFrame.time);
135                 lastFrame.outTangent = keyframe.inTangent = slope;
136
137                 //Update the last keyframe
138                 curve.MoveKey(keys.Length - 1, lastFrame);
139             }
140
141             //Add the new frame
142             curve.AddKey(keyframe);
143         }

AddLine 130 lượt xem

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