Skip to content

Commit

Permalink
konecno celo
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown-user committed Apr 12, 2014
1 parent 2e2cc12 commit 92ace74
Show file tree
Hide file tree
Showing 27 changed files with 93 additions and 100 deletions.
3 changes: 3 additions & 0 deletions Assembly-CSharp-Editor-vs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@
<Reference Include="Assembly-UnityScript-firstpass">
<HintPath>Library\ScriptAssemblies\Assembly-UnityScript-firstpass.dll</HintPath>
</Reference>
<Reference Include="Assembly-UnityScript">
<HintPath>Library\ScriptAssemblies\Assembly-UnityScript.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files\Unity\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
Expand Down
2 changes: 2 additions & 0 deletions Assembly-CSharp-Editor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@
<Project>{26993319-34F1-9C1D-33CE-E12E82A67D84}</Project> <Name>Assembly-UnityScript-firstpass</Name> </ProjectReference>
<ProjectReference Include="Assembly-CSharp.csproj">
<Project>{1A2E3DAF-B846-1C7B-A204-8CE7287CD2B7}</Project> <Name>Assembly-CSharp</Name> </ProjectReference>
<ProjectReference Include="Assembly-UnityScript.unityproj">
<Project>{C4D793C6-F294-712B-DD59-AF0E74E707D5}</Project> <Name>Assembly-UnityScript</Name> </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
2 changes: 1 addition & 1 deletion Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\Scripts\AsteroidContoller.cs" />
<Compile Include="Assets\Scripts\CameraFollow.cs" />
<Compile Include="Assets\Scripts\AsteroidDetector.cs" />
<Compile Include="Assets\Scripts\SpaceShipController.cs" />
<Compile Include="Assets\Scripts\TestDONTDELETE.cs" />
<None Include="Assets\Standard Assets\Projectors\Guidelines.txt" />
Expand Down
3 changes: 3 additions & 0 deletions Assembly-UnityScript-Editor-vs.unityproj
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
<Reference Include="Assembly-UnityScript-firstpass">
<HintPath>Library\ScriptAssemblies\Assembly-UnityScript-firstpass.dll</HintPath>
</Reference>
<Reference Include="Assembly-UnityScript">
<HintPath>Library\ScriptAssemblies\Assembly-UnityScript.dll</HintPath>
</Reference>
<Reference Include="UnityEditor.Graphs">
<HintPath>C:\Program Files\Unity\Editor\Data\Managed\UnityEditor.Graphs.dll</HintPath>
</Reference>
Expand Down
2 changes: 2 additions & 0 deletions Assembly-UnityScript-Editor.unityproj
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@
<Project>{26993319-34F1-9C1D-33CE-E12E82A67D84}</Project> <Name>Assembly-UnityScript-firstpass</Name> </ProjectReference>
<ProjectReference Include="Assembly-CSharp.csproj">
<Project>{1A2E3DAF-B846-1C7B-A204-8CE7287CD2B7}</Project> <Name>Assembly-CSharp</Name> </ProjectReference>
<ProjectReference Include="Assembly-UnityScript.unityproj">
<Project>{C4D793C6-F294-712B-DD59-AF0E74E707D5}</Project> <Name>Assembly-UnityScript</Name> </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Binary file modified Assets/Scenes/testScene.unity
Binary file not shown.
7 changes: 4 additions & 3 deletions Assets/Scripts/AsteroidContoller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ public class AsteroidContoller : MonoBehaviour

void Start ()
{
gameObject.renderer.enabled = false;
}

void Update ()
{
transform.Rotate (Vector3.forward * -90 * Time.deltaTime);
if (transform.localScale.x <= 1) {
Speed = 7;
Speed = 2.5f;
} else if (transform.localScale.x <= 2 && transform.localScale.x > 1) {
Speed = 4;
Speed = 1.5f;
} else {
Speed = 2;
Speed = 0.5f;
}

transform.position -= Vector3.right * Speed * Time.deltaTime;
Expand Down
15 changes: 15 additions & 0 deletions Assets/Scripts/AsteroidDetector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using UnityEngine;
using System.Collections;

public class AsteroidDetector : MonoBehaviour
{
void OnTriggerEnter2D (Collider2D other)
{
other.gameObject.renderer.enabled = true;
}

void OnTriggerExit2D (Collider2D other)
{
other.gameObject.renderer.enabled = false;
}
}
36 changes: 36 additions & 0 deletions Assets/Scripts/Camera Follow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma strict

var cameraTarget : GameObject; // Inspector> Assign the Camera Target NON è il target della camera ma la posizione che vuole raggiungere la camera

var smoothTime : float = 0.5;
var cameraFollowX : boolean = true; // Inspector> if is checked -> The Camera will follow X position of cameraTarget
var cameraFollowY : boolean = true; // Inspector> if is checked -> The Camera will follow Y position of cameraTarget
var cameraFollowHeight : boolean = false; // if true the Camera Y Position = cameraHeight
var cameraHeight : float = 10; // cameraHeight
var velocity : Vector2;
private var thisTransform : Transform;

function Start ()
{
thisTransform = transform;
}

function Update ()
{

if (cameraFollowX) // if cameraFollowX = true = Inspector is checked
{
thisTransform.position.x = Mathf.SmoothDamp (thisTransform.position.x, cameraTarget.transform.position.x, velocity.x, smoothTime);
}

if (cameraFollowY) // if cameraFollowY = true = Inspector is checked
{
thisTransform.position.y = Mathf.SmoothDamp (thisTransform.position.y, cameraTarget.transform.position.y, velocity.y, smoothTime);
}

if (!cameraFollowY && cameraFollowHeight) // if cameraFollowY = false = Inspector is unchecked AND cameraFollowHeight = true = Inspector is checked
{
camera.transform.position.y = cameraHeight; // The Camera Y position = cameraHeight
}

}
67 changes: 0 additions & 67 deletions Assets/Scripts/CameraFollow.cs

This file was deleted.

8 changes: 0 additions & 8 deletions Assets/Scripts/CameraFollow.cs.meta

This file was deleted.

48 changes: 27 additions & 21 deletions Assets/Scripts/SpaceShipController.cs
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
using UnityEngine;
 using UnityEngine;
using System.Collections;

public class SpaceShipController : MonoBehaviour
{

private Vector3 moveDirection;
public float moveSpeed = 2;
public float turnSpeed;
public float moveSpeed = 0;
public float turnSpeed = 0;
private Vector3 moveToward;

// Use this for initialization
void Start ()
{
moveDirection = Vector3.right;
}

// Update is called once per frame
void Update ()
{
// 1
Vector3 currentPosition = transform.position;

// 2
if (Input.GetButton ("Fire1")) {
// 3
Vector3 moveToward = Camera.main.ScreenToWorldPoint (Input.mousePosition);
// 4
moveDirection = moveToward - currentPosition;
moveDirection.z = 0;
moveDirection.Normalize ();

Vector3 target = moveDirection * moveSpeed + currentPosition;
transform.position = Vector3.Lerp (currentPosition, target, Time.deltaTime);

float targetAngle = Mathf.Atan2 (moveDirection.y, moveDirection.x) * Mathf.Rad2Deg;
transform.rotation =
Quaternion.Slerp (transform.rotation,
Quaternion.Euler (0, 0, targetAngle),
turnSpeed * Time.deltaTime);
moveToward = Camera.main.ScreenToWorldPoint (Input.mousePosition);
moveToward.z = 0;
CircleCollider2D circle = transform.GetComponent<CircleCollider2D> ();
if ((moveToward - currentPosition).sqrMagnitude > circle.radius / 15) {
moveSpeed = 5;
turnSpeed = 5;
// 4
currentPosition.z = 0;
moveDirection = moveToward - currentPosition;
moveDirection.z = 0;
moveDirection.Normalize ();


float targetAngle = Mathf.Atan2 (moveDirection.y, moveDirection.x) * Mathf.Rad2Deg;
transform.rotation =
Quaternion.Slerp (transform.rotation,
Quaternion.Euler (0, 0, targetAngle),
turnSpeed * Time.deltaTime);
collider2D.rigidbody2D.AddForce (moveDirection * moveSpeed);
}
}

}
}
Binary file modified Library/CurrentLayout.dwlt
Binary file not shown.
Binary file modified Library/InspectorExpandedItems.asset
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-Editor.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-Editor.dll.mdb
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll.mdb
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-UnityScript-Editor.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-UnityScript-Editor.dll.mdb
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll.mdb
Binary file not shown.
Binary file modified Library/assetDatabase3
Binary file not shown.
Binary file modified Library/expandedItems
Binary file not shown.
Binary file modified Library/guidmapper
Binary file not shown.
Binary file modified ProjectSettings/Physics2DSettings.asset
Binary file not shown.
Binary file modified ProjectSettings/TagManager.asset
Binary file not shown.

0 comments on commit 92ace74

Please sign in to comment.