mirror of
https://github.com/ConjureETS/OuijaMTLGJ2016.git
synced 2026-03-24 02:01:06 +00:00
31 lines
640 B
C#
31 lines
640 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
[RequireComponent(typeof(Rigidbody))]
|
|
public class SelectorWithBolts : MonoBehaviour
|
|
{
|
|
public Transform[] Bolts;
|
|
public Transform[] RootCylinders;
|
|
|
|
private Rigidbody rb;
|
|
|
|
void Awake()
|
|
{
|
|
rb = GetComponent<Rigidbody>();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
for (int i = 0; i < RootCylinders.Length; i++)
|
|
{
|
|
Vector3 constraintPos = Bolts[i].position;
|
|
RootCylinders[i].position = constraintPos;
|
|
}
|
|
}
|
|
|
|
public void ApplyForce(int playerID, Vector3 force)
|
|
{
|
|
rb.AddForceAtPosition(force, Bolts[playerID].position);
|
|
}
|
|
}
|