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; | |
using System.Collections; | |
using System.Collections.Generic; | |
// File: #SCRIPTNAME# | |
// Project: | |
// Description: | |
// Author:Esteban Padilla | |
// Email: | |
// Copyright (C) 2013, (R). All rights reserved. |
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
private float Sine(float angle){ | |
float sin = Mathf.Sin((Mathf.PI / 180)* angle); | |
return sin; | |
} | |
private float Cosine(float angle){ | |
float cosine = Mathf.Cos((Mathf.PI / 180) * angle); | |
return cosine; | |
} |
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
private float GetAngleFromPosition(float x1, float y1, float x2, float y2){ | |
float o = 0; | |
float a = 0; | |
bool doingA = false; | |
bool doingB = false; | |
bool doingC = false; | |
bool doingD = false; | |
if(x1 >= x2 && y1 <= y2){//set for A | |
o = x1 - x2; |
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; | |
using UnityEditor; | |
public class AutoSnap : EditorWindow | |
{ | |
private Vector3 prevPosition; | |
private bool doSnap = true; | |
private float snapValue = 1; | |
[MenuItem( "Edit/Auto Snap %_l" )] |
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
void MyCoroutine() { | |
print("Starting " + Time.time); | |
StartCoroutine(StartCoroutine_MyCoroutine(time)); | |
print("Before WaitAndPrint Finishes " + Time.time); | |
} | |
IEnumerator StartCoroutine_MyCoroutine(float waitTime) { | |
yield return new WaitForSeconds(waitTime); | |
print("WaitAndPrint " + Time.time); | |
} |
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
void Update () { | |
RaycastHit hit; | |
Vector3 fwd = transform.TransformDirection(Vector3.forward); | |
if (Physics.Raycast(transform.position, fwd, out hit, 10.0F)){ | |
print("There is something in front of the object!"); | |
Debug.DrawLine(transform.position, hit.collider.gameObject.transform.position, Color.red); | |
} | |