Created
September 27, 2022 07:00
-
-
Save keijiro/a798c3d34045940789a78e27910f7490 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
sealed class Test : MonoBehaviour | |
{ | |
float life; | |
void Test1() | |
{ | |
(float, int) attack = (3.5f, 8); | |
life -= attack.Item1 * attack.Item2; | |
} | |
void Test2() | |
{ | |
(float power, int count) attack = (3.5f, 8); | |
life -= attack.power * attack.count; | |
} | |
void Test3() | |
{ | |
var (power, count) = (3.5f, 8); | |
life -= power * count; | |
} | |
void Test4() | |
{ | |
var attack = (power: 3.5f, count: 8); | |
life -= attack.power * attack.count; | |
} | |
bool CheckCollision(Vector3 c, float r, out Vector3 point) | |
{ | |
point = Vector3.zero; | |
return true; | |
} | |
(bool hit, Vector3 point) CheckCollision(Vector3 c, float r) | |
{ | |
return (true, c); | |
} | |
struct Data { public bool hit; public Vector3 point; } | |
bool Test5() | |
{ | |
Data obj1, obj2; | |
(obj1.hit, obj2.point) = CheckCollision(Vector3.zero, 1); | |
return obj1.hit; | |
} | |
bool Test6() | |
{ | |
var (hit, _) = CheckCollision(Vector3.zero, 1); | |
return hit; | |
} | |
void Swap1(ref int a, ref int b) | |
{ | |
var temp = a; | |
a = b; | |
b = a; | |
} | |
void Swap2(ref int a, ref int b) | |
{ | |
(a, b) = (b, a); | |
} | |
void Start() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment