コード例 #1
0
ファイル: movementCtrl.cs プロジェクト: fd8783/Card-Rush
    // Use this for initialization
    void Awake()
    {
        anim   = GetComponent <Animator>();
        bodyRB = GetComponent <Rigidbody2D>();

        helmet           = transform.Find("bodyImg/head/helmet");
        helmetScript     = helmet.GetComponent <helmetFacing>();
        weaponCtrl       = transform.Find("weapon");
        curWeapon        = weaponCtrl.GetChild(0); //first child should be using weapon, if want to vaild, we can use CompareTag as well
        curWeaponSorting = curWeapon.GetComponent <SortingGroup>();
    }
コード例 #2
0
ファイル: aiMovement.cs プロジェクト: fd8783/Card-Rush
    // Use this for initialization
    void Awake()
    {
        anim            = GetComponent <Animator>();
        bodyRB          = GetComponent <Rigidbody2D>();
        area            = GameObject.Find("Main Camera/area").transform;
        areaLeftUpPT    = area.Find("leftUpPT").position;
        areaRightDownPT = area.Find("rightDownPT").position;

        helmet           = transform.Find("bodyImg/head/helmet");
        helmetScript     = helmet.GetComponent <helmetFacing>();
        weaponCtrl       = transform.Find("weapon");
        curWeapon        = weaponCtrl.GetChild(0); //first child should be using weapon, if want to vaild, we can use CompareTag as well
        curWeaponSorting = curWeapon.GetComponent <SortingGroup>();
        UIobj            = transform.Find("UI");
    }