using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CreatureBuilder : MonoBehaviour
{
public GameObject Head;
public GameObject Joint;
public int JointCount;
public int StartingSize;
public int StartingSizeLoop;
public float Timer;
// Start is called before the first frame update
void Start()
{
StartingSizeLoop = StartingSize;
JointCount = Random.Range(1,3);
do
{Invoke ("CreatureInit",0);
StartingSizeLoop = StartingSizeLoop -1;
} while(StartingSizeLoop > 0);
if (JointCount==-1){
JointCount=0;
}
}
// Update is called once per frame
void Update()
{
}
void CreatureInit ()
{
Instantiate (Head);
do
{
Instantiate (Joint);
JointCount = JointCount -1;
Timer=0.5f;
Timer-=Time.deltaTime;
} while(JointCount > 0);
if (JointCount == 0) {
JointCount=Random.Range(1,3);
}
}
void OnCollisionEnter (Collision , col)
{
if (col.gameObject.GetComponent(RigidBody)!=null){
gameObject.AddComponent(FixedJoint);
gameObject.GetComponent(FixedJoint).connectedBody=col.rigidbody;
}
}
}
Anybody know why I am getting the identifier expected error? Btw I have joint and head defined with rigidbodies. Thanks
↧