Skip to content

Instantly share code, notes, and snippets.

View DarkDesire's full-sized avatar
🎯
Focusing on functional programming skills

Eldar Dragomir DarkDesire

🎯
Focusing on functional programming skills
View GitHub Profile
@DarkDesire
DarkDesire / Done_BGScroller.cs
Created November 21, 2014 17:35
Scroll 2d Background
using UnityEngine;
using System.Collections;
public class Done_BGScroller : MonoBehaviour
{
public float scrollSpeed;
public float tileSizeZ;
private Vector3 startPosition;
@DarkDesire
DarkDesire / DragPanel.cs
Created November 21, 2014 17:39
UI PANES, PANELS AND WINDOWS
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;
public class DragPanel : MonoBehaviour, IPointerDownHandler, IDragHandler {
private Vector2 pointerOffset;
private RectTransform canvasRectTransform;
private RectTransform panelRectTransform;
@DarkDesire
DarkDesire / Unity3d-Typer.cs
Last active August 28, 2016 01:42
Typying text with coroutine
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
[RequireComponent(typeof(Text))]
public class Typer : MonoBehaviour {
public string msg = "Replace";
public float startDelay = 2f;
public float typeDelay = 0.01f;
@DarkDesire
DarkDesire / Unity3d-CreateLineMesh.cs
Last active August 28, 2016 01:43
CreateLineMesh
public void CreateLineMesh(Vector3[] points)
{
Mesh mesh = new Mesh();
Vector2[] uvs = new Vector2[points.Length * 2];
Vector3[] vertices = new Vector3[points.Length * 2];
int[] triangles = new int[Mathf.RoundToInt(points.Length/4) * 2 * 3];
for(int v = 0; v < vertices.Length; v += 2)
{
vertices[v] = points[v/2] - Vector3.right * 0.05f;
uvs[v] = new Vector2(vertices[v].x, vertices[v].y);
@DarkDesire
DarkDesire / MiniJSON.cs
Created November 23, 2014 16:25
MiniJSON
/*
* Copyright (c) 2013 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining
@DarkDesire
DarkDesire / BarleyBrake.cs
Last active August 28, 2016 01:44
Unity3d пятнашки (barley brake)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class BarleyBrake : MonoBehaviour
{
/// <summary>
/// Событие, которое произойдёт при победе
/// </summary>
#define OUT
// Used for saving ViewPortLocation
FVector PlayerViewPointLocation;
// Used for saving ViewPortRotation
FRotator PlayerViewPointRotation;
void GetPlayerViewPort(){
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(
OUT PlayerViewPointLocation,
#### Unreal Engine
## Default
Intermediate/
Saved/
Binaries/
DerivedDataCache/
## Extra
Content/StarterContent/HDRI
import StatType.StatType
object NewMain extends App{
val one = new Person("sss")
val two = new Person("sas") with IHaveStats
two.requirements = Set(new Force(40),new Wind(40))
two.requirements.foreach(obj => println(s"${obj.name} + ${obj.modifierType} + ${obj.value}"))
}
@DarkDesire
DarkDesire / one.scala
Created November 15, 2016 08:00
Частота символа в списке символов
val str = "abAsdhqfdkjggjsjfpg".toList
val str1 = str
.groupBy(identity) // s -> List(s,s)
.mapValues(_.size) // s -> 2
//.map( e => (e._1,e._2.length)) // s -> 2
.toList // (s,2)
// with tail recursion
def timesFirst(chars: List[Char]) : List[(Char,Int)] = {
@tailrec // comiler cheks if really tailrecursive