1. svn -> git
This commit is contained in:
63
Assets/DO_Studio/CameraMove.cs
Normal file
63
Assets/DO_Studio/CameraMove.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class CameraMove : MonoBehaviour {
|
||||
|
||||
private Vector3 ResetCamera;
|
||||
private Vector3 Origin;
|
||||
private Vector3 Diference;
|
||||
private bool Drag = false;
|
||||
void Start()
|
||||
{
|
||||
ResetCamera = Camera.main.transform.position;
|
||||
}
|
||||
void LateUpdate()
|
||||
{
|
||||
if (Input.GetMouseButton(0))
|
||||
{
|
||||
//DrawRay( [위치 값], [어느 방향+어느 길이], [색상] ): 일정 영역에 디버그용 선(Ray)을 그림
|
||||
Debug.DrawRay(transform.position, this.transform.forward * 10.0f, Color.red);
|
||||
|
||||
//충돌이 감지된 영역
|
||||
RaycastHit2D hit;
|
||||
|
||||
//마우스 포이트 근처 좌표를 만든다.
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
|
||||
//마우스 근처에 오브젝트가 있는지 확인
|
||||
hit = Physics2D.Raycast(ray.origin, ray.direction * 100);
|
||||
if (hit)
|
||||
{
|
||||
//있다!
|
||||
|
||||
//있으면 오브젝트를 저장한다.
|
||||
GameObject target = hit.collider.gameObject;
|
||||
if (target.CompareTag("Player"))
|
||||
return;
|
||||
}
|
||||
|
||||
Diference = (Camera.main.ScreenToWorldPoint(Input.mousePosition)) - Camera.main.transform.position;
|
||||
|
||||
if (Drag == false)
|
||||
{
|
||||
Drag = true;
|
||||
Origin = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Drag = false;
|
||||
}
|
||||
|
||||
if (Drag == true)
|
||||
{
|
||||
Camera.main.transform.position = Origin - Diference;
|
||||
}
|
||||
|
||||
//RESET CAMERA TO STARTING POSITION WITH RIGHT CLICK
|
||||
if (Input.GetMouseButton(1))
|
||||
{
|
||||
Camera.main.transform.position = ResetCamera;
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/DO_Studio/CameraMove.cs.meta
Normal file
12
Assets/DO_Studio/CameraMove.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab9332b8f57cab5428a3a99bec689474
|
||||
timeCreated: 1467865498
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
17
Assets/DO_Studio/D2D_DestroyAfterTime_obi.cs
Normal file
17
Assets/DO_Studio/D2D_DestroyAfterTime_obi.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
|
||||
[AddComponentMenu("Destructible 2D/D2D Destroy After Time")]
|
||||
public class D2D_DestroyAfterTime_obi : MonoBehaviour
|
||||
{
|
||||
public float Seconds = 10.0f;
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
Seconds -= Time.deltaTime;
|
||||
|
||||
if (Seconds <= 0.0f)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/DO_Studio/D2D_DestroyAfterTime_obi.cs.meta
Normal file
12
Assets/DO_Studio/D2D_DestroyAfterTime_obi.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3f225bd3f2970843bd26745f2007869
|
||||
timeCreated: 1467857986
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
108
Assets/DO_Studio/D2D_DragToShoot_obi.cs
Normal file
108
Assets/DO_Studio/D2D_DragToShoot_obi.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using UnityEngine;
|
||||
|
||||
[AddComponentMenu("Destructible 2D/D2D Drag To Shoot")]
|
||||
public class D2D_DragToShoot_obi : MonoBehaviour
|
||||
{
|
||||
public GameObject Bullet;
|
||||
|
||||
public float Power = 3.0f;
|
||||
|
||||
public float AngleOffset;
|
||||
|
||||
public float AngleRandomness;
|
||||
|
||||
public SpriteRenderer Indicator;
|
||||
|
||||
private bool down;
|
||||
|
||||
public GameObject startFirePosition = null;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
if (Indicator != null)
|
||||
Indicator = Instantiate(Indicator);
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
// End dragging?
|
||||
if (Input.GetMouseButton(0) == false && down == true)
|
||||
{
|
||||
down = false;
|
||||
|
||||
// Fire?
|
||||
if (Camera.main != null && Bullet != null)
|
||||
{
|
||||
var endMousePosition = Input.mousePosition;
|
||||
//var startPos = Camera.main.ScreenToWorldPoint(startMousePosition);
|
||||
var startPos = startFirePosition.transform.position;
|
||||
var endPos = Camera.main.ScreenToWorldPoint(endMousePosition);
|
||||
var vec = endPos - startPos;
|
||||
var angle = D2D_Helper.Atan2(vec) * -Mathf.Rad2Deg + AngleOffset + Random.Range(-0.5f, 0.5f) * AngleRandomness;
|
||||
var clone = D2D_Helper.CloneGameObject(Bullet, null, startPos, Quaternion.Euler(0.0f, 0.0f, angle));
|
||||
var cloneRb2D = clone.GetComponent<Rigidbody2D>();
|
||||
|
||||
if (cloneRb2D != null)
|
||||
{
|
||||
cloneRb2D.velocity = (startPos - endPos) * Power;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show dragging?
|
||||
if (Indicator != null)
|
||||
{
|
||||
Indicator.enabled = down;
|
||||
|
||||
if (Camera.main != null && down == true)
|
||||
{
|
||||
var currentMousePosition = Input.mousePosition;
|
||||
//var startPos = Camera.main.ScreenToWorldPoint( startMousePosition);
|
||||
var startPos = startFirePosition.transform.position;
|
||||
var currentPos = Camera.main.ScreenToWorldPoint(currentMousePosition);
|
||||
var scale = Vector3.Distance(currentPos, startPos);
|
||||
var angle = D2D_Helper.Atan2(currentPos - startPos) * Mathf.Rad2Deg;
|
||||
|
||||
//Indicator.transform.position = Camera.main.ScreenToWorldPoint(startMousePosition);
|
||||
Indicator.transform.position = startFirePosition.transform.position;
|
||||
Indicator.transform.localRotation = Quaternion.Euler(180.0f, 0.0f, angle);
|
||||
Indicator.transform.localScale = new Vector3(scale, scale, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
if (Input.GetMouseButton(0) == true && startFirePosition != null)
|
||||
{
|
||||
down = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 마우스가 내려간 오브젝트를 가지고 옵니다.
|
||||
/// </summary>
|
||||
/// <returns>선택된 오브젝트</returns>
|
||||
private GameObject GetClickedObject()
|
||||
{
|
||||
//충돌이 감지된 영역
|
||||
RaycastHit hit;
|
||||
//찾은 오브젝트
|
||||
GameObject target = null;
|
||||
|
||||
//마우스 포이트 근처 좌표를 만든다.
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
|
||||
//마우스 근처에 오브젝트가 있는지 확인
|
||||
if (true == (Physics.Raycast(ray.origin, ray.direction * 10, out hit)))
|
||||
{
|
||||
//있다!
|
||||
|
||||
//있으면 오브젝트를 저장한다.
|
||||
target = hit.collider.gameObject;
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
12
Assets/DO_Studio/D2D_DragToShoot_obi.cs.meta
Normal file
12
Assets/DO_Studio/D2D_DragToShoot_obi.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31a5b46f40f4bd44697c9d9c0ae96f07
|
||||
timeCreated: 1467857985
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
30
Assets/DO_Studio/D2D_ReplaceOnCollision_obi.cs
Normal file
30
Assets/DO_Studio/D2D_ReplaceOnCollision_obi.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
|
||||
[AddComponentMenu("Destructible 2D/D2D Replace On Collision")]
|
||||
public class D2D_ReplaceOnCollision_obi : MonoBehaviour
|
||||
{
|
||||
public float RelativeVelocityRequired;
|
||||
|
||||
public GameObject Spawn;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
|
||||
if (Spawn != null)
|
||||
{
|
||||
if (collision.relativeVelocity.magnitude >= RelativeVelocityRequired)
|
||||
{
|
||||
var contact0 = collision.contacts[0];
|
||||
|
||||
Instantiate(Spawn, contact0.point, transform.rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/DO_Studio/D2D_ReplaceOnCollision_obi.cs.meta
Normal file
12
Assets/DO_Studio/D2D_ReplaceOnCollision_obi.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 672fad19fdba49a4bbc025dfc3b74f35
|
||||
timeCreated: 1467857985
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
71
Assets/DO_Studio/Drag Indicator.prefab
Normal file
71
Assets/DO_Studio/Drag Indicator.prefab
Normal file
@@ -0,0 +1,71 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &152868
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 4
|
||||
m_Component:
|
||||
- 4: {fileID: 440870}
|
||||
- 212: {fileID: 21244208}
|
||||
m_Layer: 0
|
||||
m_Name: Drag Indicator
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &440870
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 152868}
|
||||
m_LocalRotation: {x: 0, y: 0, z: -0.7982121, w: 0.6023766}
|
||||
m_LocalPosition: {x: -7.35, y: 5.949368, z: 1}
|
||||
m_LocalScale: {x: 11.821675, y: 11.821675, z: 11.821675}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
--- !u!212 &21244208
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 152868}
|
||||
m_Enabled: 0
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_SubsetIndices:
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_UseLightProbes: 0
|
||||
m_ReflectionProbeUsage: 0
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 54398b8b4933cc64385bf6ab6089a8ea, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 152868}
|
||||
m_IsPrefabParent: 1
|
8
Assets/DO_Studio/Drag Indicator.prefab.meta
Normal file
8
Assets/DO_Studio/Drag Indicator.prefab.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7a0c6a5b99057945b7458e0701faa77
|
||||
timeCreated: 1467857995
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
41
Assets/DO_Studio/InputManager.cs
Normal file
41
Assets/DO_Studio/InputManager.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class InputManager : MonoBehaviour {
|
||||
|
||||
enum _InputStatus
|
||||
{
|
||||
NONE = 0x00,
|
||||
MOUSE_OVER = 0x01,
|
||||
MOUSE_PUSH = 0x02,
|
||||
MOUSE_UP = 0x04,
|
||||
MOUSE_MOVE = 0x08,
|
||||
};
|
||||
|
||||
private _InputStatus m_currentState = _InputStatus.NONE;
|
||||
private GameObject m_attachObject = null;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
m_currentState |= _InputStatus.MOUSE_PUSH;
|
||||
|
||||
if (Input.GetMouseButtonUp(0))
|
||||
m_currentState |= _InputStatus.MOUSE_UP;
|
||||
}
|
||||
|
||||
public void AttachObject (GameObject gameobject)
|
||||
{
|
||||
m_attachObject = gameobject;
|
||||
}
|
||||
|
||||
public void DettachObject (GameObject gameobject)
|
||||
{
|
||||
m_attachObject = null;
|
||||
}
|
||||
}
|
12
Assets/DO_Studio/InputManager.cs.meta
Normal file
12
Assets/DO_Studio/InputManager.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 837699243981a90479cb4840fe0d9229
|
||||
timeCreated: 1467857986
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
15
Assets/DO_Studio/Reference_Script.cs
Normal file
15
Assets/DO_Studio/Reference_Script.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class Reference_Script : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
12
Assets/DO_Studio/Reference_Script.cs.meta
Normal file
12
Assets/DO_Studio/Reference_Script.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9dd612fe4042bea4abff8c0e5b8b76aa
|
||||
timeCreated: 1467857986
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
9
Assets/DO_Studio/Scene.meta
Normal file
9
Assets/DO_Studio/Scene.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68d101ae25abaff4487680bc04b45a85
|
||||
folderAsset: yes
|
||||
timeCreated: 1467858178
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
1407
Assets/DO_Studio/Scene/Battle.unity
Normal file
1407
Assets/DO_Studio/Scene/Battle.unity
Normal file
File diff suppressed because it is too large
Load Diff
8
Assets/DO_Studio/Scene/Battle.unity.meta
Normal file
8
Assets/DO_Studio/Scene/Battle.unity.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca3f1f2fe6a406d41b63d6dbf22e74ae
|
||||
timeCreated: 1467858078
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user