// Start is called before the first frame update private void Start() { // Cria a lista listaJoints = new List <Transform>(); // Acha a coisas da Ashley ash = GameObject.FindGameObjectWithTag("Player"); ashCtrl = ash.GetComponent <ChrCtrl_Pipilson>(); ashCC = ash.GetComponent <CharacterController>(); anim = ash.transform.GetChild(0).GetComponent <Animator>(); // Pega o filho desse objeto Transform child = transform.GetChild(0); // Enquanto o filho não for nulo, ou seja, child tiver outro child... while (child != null) { // Adiciona o componente GrabJoint a ele GrabJoint gj = child.gameObject.AddComponent <GrabJoint>(); // Define o parametro rb como o Rigidbody dele mesmo gj.rb = child.gameObject.GetComponent <Rigidbody>(); gj.rb.centerOfMass = new Vector3(0, 0, 0); gj.rb.inertiaTensor = new Vector3(1, 1, 1); // Define o parametro paiDeTodos como essa lista gj.paiDeTodos = this; // Adiciona ele à lista listaJoints.Add(child); // E pega o child dele child = child.GetChild(0); // O loop só vai parar quando child não tiver outro child // E vai pegando os filhos de cada um no processo } }
private void Start() { cc = GetComponent <CharacterController>(); chcrt = GetComponent <ChrCtrl_Pipilson>(); ganchoPrefab = Resources.Load <GameObject>("Gancho_Prefab"); anim = transform.GetChild(0).GetComponent <Animator>(); mao = GameObject.Find("SpawnGancho").transform; }
void Start() { // Pega o controle da Ash no mesmo GameObject ashCtrl = GetComponent <ChrCtrl_Pipilson>(); // Começa com o combustível atual no máximo combustivelAtual = combustivelMaximo; }
private void Awake() { cm = Camera.main.GetComponent <followCamera>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <ChrCtrl_Pipilson>(); PauseCamera(); menuScreen = GameObject.Find("Menu"); //ui = GameObject.Find("UI"); }