basic conveyer function and direction switching stub

This commit is contained in:
Amaan Shawkath
2021-06-12 00:05:27 +01:00
parent 09c5e64772
commit 3c737d5d4c
12 changed files with 6348 additions and 0 deletions

View 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);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cc929a06dbaee75449c67c4656d3c5cc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5e454d0c686916f45856da8b9d021191
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: