basic conveyer function and direction switching stub
This commit is contained in:
17
Assets/Deadend.cs
Normal file
17
Assets/Deadend.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Deadend : MonoBehaviour
|
||||
{
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
Debug.Log(string.Format("we collided with the thingie {0}", other.name));
|
||||
|
||||
if (other.GetComponent<DestructibleObject>() != null)
|
||||
{
|
||||
DestructibleObject destructibleObject = other.GetComponent<DestructibleObject>();
|
||||
destructibleObject.Respawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Deadend.cs.meta
Normal file
11
Assets/Deadend.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27a682c9746255b43a64fd0ad0f6ba29
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
Assets/DirectionPaddle.cs
Normal file
11
Assets/DirectionPaddle.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DirectionPaddle : MonoBehaviour
|
||||
{
|
||||
public void Switch()
|
||||
{
|
||||
gameObject.SetActive(!gameObject.activeSelf);
|
||||
}
|
||||
}
|
||||
11
Assets/DirectionPaddle.cs.meta
Normal file
11
Assets/DirectionPaddle.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dd01c3c2c2957047b7d50418f02cc31
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
6207
Assets/Models/Amain.unity
Normal file
6207
Assets/Models/Amain.unity
Normal file
File diff suppressed because one or more lines are too long
7
Assets/Models/Amain.unity.meta
Normal file
7
Assets/Models/Amain.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e28590837d6b244caf7dd722c8d5ae5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts.meta
Normal file
8
Assets/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2d307965e4fb804380e15ce0646c757
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Scripts/Items.meta
Normal file
8
Assets/Scripts/Items.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c868648fb306a754d97ac1fca5205c66
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
25
Assets/Scripts/Items/Conveyer.cs
Normal file
25
Assets/Scripts/Items/Conveyer.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Conveyer : MonoBehaviour
|
||||
{
|
||||
public int conveyerSpeed = 0;
|
||||
public int direction = 1;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnCollisionStay(Collision collision)
|
||||
{
|
||||
// Debug-draw all contact points and normals
|
||||
foreach (ContactPoint contact in collision.contacts)
|
||||
{
|
||||
//Debug.Log(string.Format("Current Collider: {0} Position {1}", contact.otherCollider.name, contact.otherCollider.transform.position.magnitude));
|
||||
contact.otherCollider.GetComponent<Rigidbody>().AddForce(transform.forward * (conveyerSpeed * direction), ForceMode.Acceleration);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Items/Conveyer.cs.meta
Normal file
11
Assets/Scripts/Items/Conveyer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc929a06dbaee75449c67c4656d3c5cc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
21
Assets/Scripts/Items/DestructibleObject.cs
Normal file
21
Assets/Scripts/Items/DestructibleObject.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DestructibleObject : MonoBehaviour
|
||||
{
|
||||
private Vector3 originalPosition;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
originalPosition = gameObject.transform.position;
|
||||
}
|
||||
|
||||
public void Respawn()
|
||||
{
|
||||
gameObject.GetComponent<Rigidbody>().isKinematic = true;
|
||||
gameObject.transform.position = originalPosition;
|
||||
gameObject.GetComponent<Rigidbody>().isKinematic = false;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Items/DestructibleObject.cs.meta
Normal file
11
Assets/Scripts/Items/DestructibleObject.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e454d0c686916f45856da8b9d021191
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user