コード例 #1
0
ファイル: ListaJoints.cs プロジェクト: MarkiedStudent/TCC2019
    // 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
        }
    }
コード例 #2
0
 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;
 }
コード例 #3
0
    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;
    }
コード例 #4
0
ファイル: MenuCamera.cs プロジェクト: MarkiedStudent/TCC2019
    private void Awake()
    {
        cm     = Camera.main.GetComponent <followCamera>();
        player = GameObject.FindGameObjectWithTag("Player").GetComponent <ChrCtrl_Pipilson>();
        PauseCamera();

        menuScreen = GameObject.Find("Menu");

        //ui = GameObject.Find("UI");
    }