mirror of
https://github.com/chibicitiberiu/frica-de-gaze
synced 2024-02-24 08:23:32 +00:00
Fixed everything, added sound, etc.
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class AddSpider : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
public GameObject enemy;
|
||||
public misca2 sc;
|
||||
|
||||
IEnumerator Start() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
yield return new WaitForSeconds(Random.Range(0, 5.0f));
|
||||
Instantiate(enemy);
|
||||
|
||||
enemy.transform.position = new Vector3(Random.Range(-2.5f, 2.5f),0,Random.Range(-0.5f, 0.5f));
|
||||
sc=enemy.AddComponent("misca2") as misca2;
|
||||
|
||||
//sc.Invoke("Start()",0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
BIN
FricaDeGaze/Assets/Materials/BounceMaterial.physicMaterial
Normal file
BIN
FricaDeGaze/Assets/Materials/BounceMaterial.physicMaterial
Normal file
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5e16dbd542e6b640aa077bdb3c5ae44
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
@@ -1,44 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class MisacaPaianjen : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
itembounce();
|
||||
}
|
||||
|
||||
Vector3 speed = new Vector3(0,0.002f,0);
|
||||
|
||||
bool bouncing = true;
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
if (bouncing == true) {
|
||||
this.transform.position += speed;
|
||||
} else if (bouncing == false) {
|
||||
this.transform.position -= speed;
|
||||
}
|
||||
|
||||
//bouncing = !bouncing;
|
||||
}
|
||||
|
||||
|
||||
IEnumerator itembounce() {
|
||||
|
||||
for(int i=0;i>1;i++)
|
||||
{
|
||||
|
||||
// yield return new WaitForSeconds(0.002f);
|
||||
//bouncing = !bouncing;
|
||||
|
||||
bouncing = !bouncing;
|
||||
yield return new WaitForSeconds(0.002f);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class RandomSpider : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
5
FricaDeGaze/Assets/Scripts.meta
Normal file
5
FricaDeGaze/Assets/Scripts.meta
Normal file
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3596652f82a84a6488d81ef553a58c96
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
34
FricaDeGaze/Assets/Scripts/AddSpider.cs
Normal file
34
FricaDeGaze/Assets/Scripts/AddSpider.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class AddSpider : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
public GameObject enemy;
|
||||
public SpiderMove sc;
|
||||
|
||||
float randomInterval = 5.0f;
|
||||
|
||||
IEnumerator Start()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
yield return new WaitForSeconds(Random.Range(randomInterval, 2 * randomInterval));
|
||||
|
||||
if (randomInterval > .2f)
|
||||
randomInterval -= randomInterval / 10;
|
||||
|
||||
Instantiate(enemy);
|
||||
|
||||
float scale = Random.Range(.5f / randomInterval, .5f / randomInterval);
|
||||
|
||||
enemy.transform.position = new Vector3(-4, 0, -4);
|
||||
enemy.transform.localScale = new Vector3(scale, scale, scale);
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
29
FricaDeGaze/Assets/Scripts/BallCollisionWithSpider.cs
Normal file
29
FricaDeGaze/Assets/Scripts/BallCollisionWithSpider.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class BallCollisionWithSpider : MonoBehaviour {
|
||||
|
||||
public AudioSource SoundToPlay;
|
||||
|
||||
void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (other.gameObject.name.Contains ("Spider"))
|
||||
{
|
||||
Destroy (gameObject);
|
||||
Destroy (other.gameObject);
|
||||
|
||||
SoundToPlay.enabled = true;
|
||||
SoundToPlay.Play ();
|
||||
}
|
||||
}
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82e5532adcca69249891443803001d52
|
||||
guid: 11f62baee581a48498f4d97b47844f9e
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
38
FricaDeGaze/Assets/Scripts/BallShoot.cs
Normal file
38
FricaDeGaze/Assets/Scripts/BallShoot.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class BallShoot : MonoBehaviour {
|
||||
|
||||
public GameObject Ball;
|
||||
public float ThrowSpeed = 10f;
|
||||
public AudioSource ThrowSound;
|
||||
|
||||
private float LastThrowTime = 0;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
Physics.gravity = new Vector3(0, -20, 0);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
var direction = Camera.main.transform.forward;
|
||||
|
||||
if (Input.GetButton ("Fire1") && LastThrowTime + .05 < Time.timeSinceLevelLoad)
|
||||
{
|
||||
// Throw ball
|
||||
var ball = Instantiate(Ball) as GameObject;
|
||||
ball.transform.position = Camera.main.transform.position + direction;
|
||||
ball.rigidbody.AddForce(direction * ThrowSpeed, ForceMode.Impulse);
|
||||
|
||||
LastThrowTime = Time.timeSinceLevelLoad;
|
||||
|
||||
// Play sound
|
||||
if (ThrowSound != null)
|
||||
ThrowSound.Play();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6e251b779901f04db3728b14fd0da67
|
||||
guid: 4e5915773de69b14fb8e8a5f0fdd1d3d
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
43
FricaDeGaze/Assets/Scripts/SpiderMove.cs
Normal file
43
FricaDeGaze/Assets/Scripts/SpiderMove.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class SpiderMove : MonoBehaviour {
|
||||
|
||||
public float Speed;
|
||||
|
||||
Vector3 source;
|
||||
Vector3 destination;
|
||||
|
||||
Vector3 generaterandom()
|
||||
{
|
||||
// Generate positions outside box
|
||||
float x, z;
|
||||
x = Random.Range(-4f, 4f);
|
||||
z = -Random.Range(-4f, 4f);
|
||||
|
||||
return new Vector3 (x, .2f, z);
|
||||
}
|
||||
|
||||
IEnumerator Start () {
|
||||
|
||||
|
||||
source = generaterandom ();
|
||||
destination = generaterandom ();
|
||||
|
||||
gameObject.transform.forward = destination - source;
|
||||
gameObject.transform.position = source;
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update ()
|
||||
{
|
||||
gameObject.transform.position += gameObject.transform.forward * Speed;
|
||||
|
||||
if (Mathf.Abs(gameObject.transform.position.x) > 5f
|
||||
|| Mathf.Abs(gameObject.transform.position.y) > 5f
|
||||
|| Mathf.Abs(gameObject.transform.position.z) > 5f)
|
||||
Destroy (gameObject);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f63a20eaa3e3c1841b079fecfda81c75
|
||||
guid: 2fd658d74558a1a4090b8cef4b940993
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
5
FricaDeGaze/Assets/Sounds.meta
Normal file
5
FricaDeGaze/Assets/Sounds.meta
Normal file
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d12adab5d9699aa48a8fd9a05c04daf8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 998364551f10b174c93126406e10665f
|
||||
AudioImporter:
|
||||
serializedVersion: 4
|
||||
format: 0
|
||||
quality: -1
|
||||
stream: 1
|
||||
3D: 1
|
||||
forceToMono: 0
|
||||
useHardware: 0
|
||||
loopable: 0
|
||||
userData:
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30c27eb7e090f9942a0bea7796059bf6
|
||||
AudioImporter:
|
||||
serializedVersion: 4
|
||||
format: 0
|
||||
quality: .5
|
||||
stream: 1
|
||||
3D: 0
|
||||
forceToMono: 0
|
||||
useHardware: 0
|
||||
loopable: 0
|
||||
userData:
|
||||
BIN
FricaDeGaze/Assets/Sounds/Woosh-Mark_DiAngelo-4778593.wav
Normal file
BIN
FricaDeGaze/Assets/Sounds/Woosh-Mark_DiAngelo-4778593.wav
Normal file
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e362b2e20aed9e459a1adcbb1c529ca
|
||||
AudioImporter:
|
||||
serializedVersion: 4
|
||||
format: -1
|
||||
quality: -1
|
||||
stream: 1
|
||||
3D: 1
|
||||
forceToMono: 0
|
||||
useHardware: 0
|
||||
loopable: 0
|
||||
userData:
|
||||
BIN
FricaDeGaze/Assets/Sphere.prefab
Normal file
BIN
FricaDeGaze/Assets/Sphere.prefab
Normal file
Binary file not shown.
4
FricaDeGaze/Assets/Sphere.prefab.meta
Normal file
4
FricaDeGaze/Assets/Sphere.prefab.meta
Normal file
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c2216c65b2d8cb409b1331bebd3bed8
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
FricaDeGaze/Assets/SpiderPrefab 1.controller
Normal file
BIN
FricaDeGaze/Assets/SpiderPrefab 1.controller
Normal file
Binary file not shown.
4
FricaDeGaze/Assets/SpiderPrefab 1.controller.meta
Normal file
4
FricaDeGaze/Assets/SpiderPrefab 1.controller.meta
Normal file
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbc9fde9047893846b7a5d96a9f2fb35
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
FricaDeGaze/Assets/SpiderPrefab.controller
Normal file
BIN
FricaDeGaze/Assets/SpiderPrefab.controller
Normal file
Binary file not shown.
4
FricaDeGaze/Assets/SpiderPrefab.controller.meta
Normal file
4
FricaDeGaze/Assets/SpiderPrefab.controller.meta
Normal file
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c64c7d6dbb8aa1049b06acc13410688f
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
FricaDeGaze/Assets/SpiderPrefab.prefab
Normal file
BIN
FricaDeGaze/Assets/SpiderPrefab.prefab
Normal file
Binary file not shown.
4
FricaDeGaze/Assets/SpiderPrefab.prefab.meta
Normal file
4
FricaDeGaze/Assets/SpiderPrefab.prefab.meta
Normal file
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8d7b6d00b9e9fb41820f68dd8bb7eef
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,77 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class misca2 : MonoBehaviour {
|
||||
|
||||
public Transform target;
|
||||
public float RotationSpeed;
|
||||
|
||||
IEnumerator Start () {
|
||||
|
||||
//yield return new WaitForSeconds (0.2f);
|
||||
//float width = camera.pixelWidth;
|
||||
/*float speed = 1;
|
||||
//move towards the center of the world (or where ever you like)
|
||||
Vector3 targetPosition = target.position;
|
||||
|
||||
Vector3 currentPosition = this.transform.position;
|
||||
//first, check to see if we're close enough to the target
|
||||
if(Vector3.Distance(currentPosition, targetPosition) > .1f) {
|
||||
Vector3 directionOfTravel = targetPosition - currentPosition;
|
||||
//now normalize the direction, since we only want the direction information
|
||||
directionOfTravel.Normalize();
|
||||
//scale the movement on each axis by the directionOfTravel vector components
|
||||
|
||||
this.transform.Translate(
|
||||
0,
|
||||
(directionOfTravel.y * speed * Time.deltaTime),
|
||||
0,
|
||||
Space.World);
|
||||
}*/
|
||||
//transform.RotateAround (target.position, new Vector3 (0, target.position.y, 0), 0);
|
||||
//transform.position = new Vector3(target.position.x,0.1f+target.position.y,target.position.z);
|
||||
float dis = Vector3.Distance (transform.position, target.position);
|
||||
float xpos = Random.Range (-target.position.x, target.position.x);
|
||||
//while (xpos > target.position.x)
|
||||
xpos = Random.Range (-target.position.x, target.position.x);
|
||||
float zpos = Random.Range (-target.position.z, target.position.z);
|
||||
//while (zpos > target.position.z)
|
||||
zpos = Random.Range (-target.position.z, target.position.z);
|
||||
|
||||
Vector3 position = new Vector3(xpos, 0, zpos);
|
||||
//transform.TransformVector (new Vector3(target.position.x,target.position.y,target.position));
|
||||
|
||||
Vector3 pointA = transform.position;
|
||||
//Vector3 pointB = pointA + new Vector3 (0.5f,0,0.5f);
|
||||
while (true) {
|
||||
yield return StartCoroutine(MoveObject(transform, pointA, position, 0.1f));
|
||||
yield return StartCoroutine(MoveObject(transform, position, pointA, 0.1f));
|
||||
//while (xpos > target.position.x)
|
||||
xpos = Random.Range (-target.position.x, target.position.x);
|
||||
//while (zpos > target.position.z)
|
||||
zpos = Random.Range (-target.position.z, target.position.z);
|
||||
position.x = xpos;
|
||||
position.z = zpos;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator MoveObject (Transform thisTransform, Vector3 startPos, Vector3 endPos, float time) {
|
||||
|
||||
|
||||
float i = 0.0f;
|
||||
float rate = 0.1f / time;
|
||||
while (i < 1.0f) {
|
||||
i += Time.deltaTime * rate;
|
||||
thisTransform.position = Vector3.Lerp(startPos, endPos, i);
|
||||
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class misca3 : MonoBehaviour {
|
||||
|
||||
|
||||
|
||||
IEnumerator Start () {
|
||||
yield return new WaitForSeconds (0.5f);
|
||||
Vector3 pointA = transform.position;
|
||||
Vector3 pointB = pointA + new Vector3 (0,0.05f,0);
|
||||
while (true) {
|
||||
yield return StartCoroutine(MoveObject(transform, pointA, pointB, 0.5f));
|
||||
yield return StartCoroutine(MoveObject(transform, pointB, pointA, 0.5f));
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator MoveObject (Transform thisTransform, Vector3 startPos, Vector3 endPos, float time) {
|
||||
float i = 0.0f;
|
||||
float rate = 1.0f / time;
|
||||
while (i < 1.0f) {
|
||||
i += Time.deltaTime * rate;
|
||||
thisTransform.position = Vector3.Lerp(startPos, endPos, i);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0d2b45e067b8af4aafe3029b5b82676
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user