forked from JXPorter/OkitaUnity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.cs
More file actions
137 lines (131 loc) · 2.23 KB
/
Example.cs
File metadata and controls
137 lines (131 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
// int a = 8;
// float b = 7f;
// //first version of a function
// int HalfValue(int a)
// {
// return a / 2;
// }
// //second version of a function
// float HalfValue(float a)
// {
// return a / 2.0f;
// }
// int a = 8;
// float b = 7;
//
// int HalfValue(int a)
// {
// return a / 2;
// }
//
// int HalfValue(float a)
// {
// return (int)a / 2;
// }
// int a = 8;
// float b = 7;
//
// int HalfValue(int a)
// {
// return a / 2;
// }
//
// int HalfValue(int a)//oops?
// {
// return a * 0.5;
// }
//
// int RetVal()
// {
// return 1;
// }
//
// float RetVal()
// {
// return 1.0f;
// }
// void Start()
// {
// int a = RetVal();
// float b = RetVal();
// }
// public static int Reloaded()
// {
// return 1;
// }
//
// public static int Reloaded(int a)
// {
// return 1 + a;
// }
//
// public static float Reloaded(int a, float b)
// {
// return a / b;
// }
//
// void Start()
// {
// int a = Reloaded();
// int b = Reloaded(3);
// float c = Reloaded(3, 2.0f);
// print(a); //prints 1
// print(b); //prints 4
// print(c); //prints 1.5
// }
// public static void Reloaded(int a, ref float b)
// {
// b = (float)a / 3;
// }
//
// void Start()
// {
// float d = 0;
// Reloaded(1, ref d);
// System.Console.WriteLine(d);
// }
// public static double classInt = 13; // class scoped number
//
// public static void Reloaded(double b)
// {
// classInt = b;
// }
//
// void Start()
// {
// print(classInt); // prints 13
// Reloaded(9.0); //sets the classInt to 9.0
// print(classInt); //prints 9
// }
GameObject CreateObject()
{
GameObject g = GameObject.CreatePrimitive(PrimitiveType.Cube);
return g;
}
GameObject CreateObject(PrimitiveType pt)
{
GameObject g = GameObject.CreatePrimitive(pt);
return g;
}
GameObject CreateObject(PrimitiveType pt, Vector3 loc)
{
GameObject g = GameObject.CreatePrimitive(pt);
g.transform.position = loc;
return g;
}
// Use this for initialization
void Start()
{
GameObject a = CreateObject();
GameObject b = CreateObject(PrimitiveType.Cylinder);
GameObject c = CreateObject(PrimitiveType.Sphere, new Vector3(2.0f, 3.5f, 1.3f));
}
// Update is called once per frame
void Update()
{
}
}