Merge branch 'darrel'
Manually resolved conflicts. Discarded scene changes.
This commit is contained in:
commit
071230b9f2
5 changed files with 57 additions and 3 deletions
30
Game 1/Assets/Scripts/CameraController.cs
Normal file
30
Game 1/Assets/Scripts/CameraController.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraController : MonoBehaviour {
|
||||
|
||||
public GameObject player;
|
||||
|
||||
private Vector3 offset;
|
||||
private Vector3 newPosition;
|
||||
|
||||
private float minX, maxX, minY, maxY;
|
||||
|
||||
void Start () {
|
||||
offset = transform.position - player.transform.position;
|
||||
|
||||
minX = 0.0f;
|
||||
maxX = 0.0f;
|
||||
minY = 0.0f;
|
||||
maxY = 18.0f;
|
||||
}
|
||||
|
||||
void LateUpdate () {
|
||||
newPosition = player.transform.position + offset;
|
||||
|
||||
if(newPosition.x >= minX && newPosition.x <= maxX && newPosition.y >= minY && newPosition.y <= maxY)
|
||||
transform.position = newPosition;
|
||||
|
||||
}
|
||||
}
|
12
Game 1/Assets/Scripts/CameraController.cs.meta
Normal file
12
Game 1/Assets/Scripts/CameraController.cs.meta
Normal file
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 82066df26cc71bd46bc0762b0aba7372
|
||||
timeCreated: 1504643500
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,6 +1,7 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
// Simple script for a test I need to do
|
||||
|
||||
|
@ -9,9 +10,11 @@ public class PlayerController : MonoBehaviour {
|
|||
public float jumpPower;
|
||||
public GameObject rocketPrefab;
|
||||
|
||||
public Text winText;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
@ -29,4 +32,12 @@ public class PlayerController : MonoBehaviour {
|
|||
rocket.GetComponent<RocketController>().player = this;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
//Check the provided Collider2D parameter other to see if it is tagged "PickUp", if it is...
|
||||
if (other.gameObject.CompareTag ("Finish Line")) {
|
||||
winText.text = "You Win!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
m_EditorVersion: 2017.1.1f1
|
||||
m_EditorVersion: 2017.1.0f3
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
--- !u!78 &1
|
||||
TagManager:
|
||||
serializedVersion: 2
|
||||
tags: []
|
||||
tags:
|
||||
- Finish Line
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
|
Reference in a new issue