Added project
This commit is contained in:
20
HW02 - Base programming/Assets/Scripts/Hw2P1.cs
Normal file
20
HW02 - Base programming/Assets/Scripts/Hw2P1.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Hw2P1 : MonoBehaviour {
|
||||
|
||||
public int sideOfSquare = 2;
|
||||
public int sideAofRectangle = 3;
|
||||
public int sideBOfRectangle = 4;
|
||||
public float circleRadius = 3.5f;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
int squareArea = sideOfSquare * sideOfSquare;
|
||||
int rectangleArea = sideAofRectangle * sideBOfRectangle;
|
||||
float circleArea = Mathf.PI * circleRadius * circleRadius;
|
||||
Debug.Log($"Площадь квадрата со стороной {sideOfSquare} равна {squareArea}");
|
||||
Debug.Log($"Площадь прямоугольника со cторонами A = {sideAofRectangle} и B = {sideBOfRectangle} равна {rectangleArea}");
|
||||
Debug.Log($"Площадь окружности с радиусом R = {circleRadius} равна {circleArea}");
|
||||
}
|
||||
|
||||
}
|
||||
11
HW02 - Base programming/Assets/Scripts/Hw2P1.cs.meta
Normal file
11
HW02 - Base programming/Assets/Scripts/Hw2P1.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce93cea7541f36a0c82f8cc6c3ff6ce2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
HW02 - Base programming/Assets/Scripts/Hw2P2.cs
Normal file
40
HW02 - Base programming/Assets/Scripts/Hw2P2.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Hw2P2 : MonoBehaviour {
|
||||
|
||||
public int apples = 3;
|
||||
public int oranges = 5;
|
||||
public int tomatoes = 2;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
if (apples >= oranges) {
|
||||
if (oranges >= tomatoes) {
|
||||
Debug.Log("Яблоки");
|
||||
Debug.Log("Апельсины");
|
||||
Debug.Log("Помидоры");
|
||||
} else if (tomatoes >= apples) {
|
||||
Debug.Log("Помидоры");
|
||||
Debug.Log("Яблоки");
|
||||
Debug.Log("Апельсины");
|
||||
} else {
|
||||
Debug.Log("Яблоки");
|
||||
Debug.Log("Помидоры");
|
||||
Debug.Log("Апельсины");
|
||||
}
|
||||
} else if (tomatoes >= oranges) {
|
||||
Debug.Log("Помидоры");
|
||||
Debug.Log("Апельсины");
|
||||
Debug.Log("Яблоки");
|
||||
} else if (apples >= tomatoes) {
|
||||
Debug.Log("Апельсины");
|
||||
Debug.Log("Яблоки");
|
||||
Debug.Log("Помидоры");
|
||||
} else {
|
||||
Debug.Log("Апельсины");
|
||||
Debug.Log("Помидоры");
|
||||
Debug.Log("Яблоки");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
HW02 - Base programming/Assets/Scripts/Hw2P2.cs.meta
Normal file
11
HW02 - Base programming/Assets/Scripts/Hw2P2.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97483f62e206c8a3bb3dd7e9b48bce1a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
HW02 - Base programming/Assets/Scripts/Hw2P3.cs
Normal file
16
HW02 - Base programming/Assets/Scripts/Hw2P3.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Hw2P3 : MonoBehaviour {
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
long paperThickness = 1;
|
||||
long distanceFromEarthToMoon = 300000L * 1000L * 100L * 10L;
|
||||
int count = 0;
|
||||
while (paperThickness < distanceFromEarthToMoon) {
|
||||
paperThickness *= 2;
|
||||
count++;
|
||||
}
|
||||
Debug.Log($"{count} раз необходимо сложить бесконечный лист бумаги что бы достичь Луны");
|
||||
}
|
||||
|
||||
}
|
||||
11
HW02 - Base programming/Assets/Scripts/Hw2P3.cs.meta
Normal file
11
HW02 - Base programming/Assets/Scripts/Hw2P3.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ca837ad9bf5423f3ab25ca6f519b890
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
HW02 - Base programming/Assets/Scripts/Hw2P4.cs
Normal file
15
HW02 - Base programming/Assets/Scripts/Hw2P4.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class Hw2P4 : MonoBehaviour {
|
||||
|
||||
public SpriteRenderer[] spriteRenderers;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
foreach (var spriteRenderer in spriteRenderers) {
|
||||
spriteRenderer.color = new Color(Random.value, Random.value, Random.value, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
11
HW02 - Base programming/Assets/Scripts/Hw2P4.cs.meta
Normal file
11
HW02 - Base programming/Assets/Scripts/Hw2P4.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4f1d31e30ae19339b55437ae98064a2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
23
HW02 - Base programming/Assets/Scripts/Hw2P5P6P7.cs
Normal file
23
HW02 - Base programming/Assets/Scripts/Hw2P5P6P7.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Hw2P5P6P7 : MonoBehaviour {
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
Debug.Log(compare(3, 4));
|
||||
printMessage();
|
||||
Debug.Log(circleArea(3.5f));
|
||||
}
|
||||
|
||||
public bool compare(int x, int y) {
|
||||
return x > y;
|
||||
}
|
||||
|
||||
public void printMessage() {
|
||||
Debug.Log("Hello World!");
|
||||
}
|
||||
|
||||
public float circleArea(float radius) {
|
||||
return Mathf.PI * (radius * radius);
|
||||
}
|
||||
|
||||
}
|
||||
11
HW02 - Base programming/Assets/Scripts/Hw2P5P6P7.cs.meta
Normal file
11
HW02 - Base programming/Assets/Scripts/Hw2P5P6P7.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 145a41c92580bdd42b2157e0b69ebf65
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user