-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtilities.cs
74 lines (64 loc) · 1.79 KB
/
Utilities.cs
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
//Utilities to be used in future projects
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class Utilities
{
public static string ProcessText(string textIn)
{
//return (textIn);
if (double.TryParse(textIn, out double num))
{
return ("Number");
}
else
{
return ("String");
}
}
}
class Person
{
public string Name;
public virtual void SayHello()
{
Console.WriteLine("Hello");
}
}
class RenFairePerson : Person
{
public override void SayHello()
{
Console.Write("Huzzah!");
}
}
RenFairePerson person = new RenFairePerson();
person.Name = "Igor the Ratcatcher";
person.SayHello();RenFairePerson person = new RenFairePerson();
person.Name = "Igor the Ratcatcher";
person.SayHello();
base.SayHello();
//List info
var index = names.IndexOf("Felipe");
if (index != -1)
Console.WriteLine($"The name {names[index]} is at index {index}");
var notFound = names.IndexOf("Not Found");
Console.WriteLine($"When an item is not found, IndexOf returns {notFound}");
names.Sort();
foreach (var name in names)
{
Console.WriteLine($"Hello {name.ToUpper()}!");
}
/* Useful stuff:
*
* cube = transform.Find("Cube").gameObject; //find a reference by transform
* bndCheck = GetComponent<BoundsCheck>(); // then get a script attached to that object
* Vector3 vel = Random.onUnitSphere; //Random xyz velocity
* vel.Normalize(); //make length of vector 1m
* vel *= Random.Range(driftMinMax.x, driftMinMax.y, drifMinMax.z); //set the drift
* transform.rotation = Quaternion.identity;
rotPerSecond = new Vector3(Random.Range(rotMinMax.x, rotMinMax.y),
Random.Range(rotMinMax.x, rotMinMax.y),
Random.Range(rotMinMax.x, rotMinMax.y));
*
*/