Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
[RequireComponent(typeof(CharacterController))]
public class AdvancedCharacterController : MonoBehaviour
{
[SerializeField] private float _speed = 5.0f; // Скорость передвижения персонажа
[SerializeField] private float _gravity = 9.8f; // Гравитация, влияющая на падение персонажа
[SerializeField] private float _jumpForce = 8.0f; // Сила прыжка персонажа
[SerializeField] private float _slopeForce = 5.0f; // Сила, добавляемая для движения по наклонным поверхностям
[SerializeField] private float _slopeRayLength = 1.5f; // Длина луча, используемая для определения наклонной поверхности
@SamatKadyrov
SamatKadyrov / MathfAbsExample.cs
Last active December 5, 2023 18:28
Mathf Methods
using UnityEngine;
public class MathfAbsExample : MonoBehaviour
{
[SerializeField] private int _number = -5;
private void Start()
{
Debug.Log(Mathf.Abs(_number)); // выведет: 5
}
@SamatKadyrov
SamatKadyrov / Vector3Angle.cs
Last active December 5, 2023 18:28
Vector3 Static Methods
using UnityEngine;
public class Vector3StaticMethods : MonoBehaviour
{
[SerializeField] private Vector3 _vector1 = new Vector3(1f, 0f, 0f);
[SerializeField] private Vector3 _vector2 = new Vector3(0f, 1f, 0f);
private float _angle;
private void Start()
using UnityEngine;
public class VectorOperations : MonoBehaviour
{
[SerializeField] private Vector3 _vectorA;
[SerializeField] private Vector3 _vectorB;
[SerializeField] private Vector3 _vectorC;
private Vector3 _side1;
private Vector3 _side2;
using UnityEngine;
public class VectorOperations : MonoBehaviour
{
[SerializeField] private Vector3 _playerPosition = new Vector2(3, 1);
[SerializeField] private Vector3 _guardPosition = new Vector2(1, 2);
private float _dotResult;
private Vector3 _fieldOfView = new Vector2(1, 1);
@SamatKadyrov
SamatKadyrov / Block.cs
Last active December 5, 2023 18:27
Minecraft and grenades
using UnityEngine;
[RequireComponent(typeof(BoxCollider))]
public class Block : MonoBehaviour
{
public void Destroy()
{
Destroy(gameObject);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TrigonometricFunctions : MonoBehaviour
{
[SerializeField] private Transform _obj; //объект, который будет двигаться
[SerializeField] private float _speed = 2.0f;
[SerializeField] private float _amplitudeX = 1.0f;
[SerializeField] private float _amplitudeY = 1.0f;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Circumference : MonoBehaviour
{
[SerializeField] private Transform _target;
[SerializeField] private List<Transform> _surrounders;
[SerializeField] private float _radius;
@SamatKadyrov
SamatKadyrov / AmbientListener.cs
Created December 5, 2023 18:26
Sounds in Games
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AmbientListener : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{