Example #1
0
 void Start()
 {
     DontDestroyOnLoad(transform.parent);
     playerAniCon = GetComponent <AnimationController>();
     weaponType   = GetComponent <HeroCustomize>().IndexWeapon.CurrentType;
     shotMgr      = GetComponentInChildren <ShotManager>();
     shotMgr.ShotPosChange(weaponType);
     hpText       = GameObject.Find("Canvas").transform.GetChild(1).GetComponent <Text>();
     enemyHpBar   = transform.Find("Canvas").transform.GetChild(0).GetComponent <HpBar>();
     s_itemSpawn2 = GameObject.Find("itemSpawnArr").GetComponent <itemSpawn2>();
     effSound     = gameObject.GetComponentInChildren <EffSoundController>();
 }
    void Awake()
    {
        DontDestroyOnLoad(transform.parent);
        sockServObj = GameObject.Find("GameMgr2/MatchingCntrl");
        playerInfo  = sockServObj.GetComponent <GameEnterScript>();
        weaponNum   = playerInfo.savCharInfo.weapon;

        spawnInfo = sockServObj.GetComponent <SpawnScript>();

        GM      = GameObject.Find("GameMgr2/itemFieldCntrl").GetComponent <ItemFieldCntrl>();
        shotMgr = GetComponentInChildren <ShotManager>();
        shotMgr.ShotPosChange(weaponNum);
        shotMgr.point = GameObject.Find("PointPrefab");
        shotMgr.point.SetActive(false);

        playerRigidBody = GetComponent <Rigidbody>();
        playerAniCon    = GetComponent <AnimationController>();
        StartCoroutine(MoveDelay()); //플레이어의 정보 전송하는 코루틴
        hpText      = GameObject.Find("Canvas").transform.GetChild(0).GetComponent <Text>();
        playerHPBar = GameObject.Find("Canvas").transform.GetChild(3).GetComponent <HpBar>();
        Block       = GameObject.Find("Canvas").transform.GetChild(4).gameObject;

        highlightBox = transform.Find("chkHighlight").gameObject;
        playerCamera = transform.Find("Camera").GetComponent <Camera>();

        s_itemSpawn2 = GameObject.Find("itemSpawnArr").GetComponent <itemSpawn2>();
        s_hitEffect  = GameObject.Find("HitEffect").GetComponent <hitEffect>();
        ChinkEffect  = GameObject.Find("ChinkEffect");

        nowRot = transform.localRotation;

        ItemImg = new GameObject[4];
        ItemImg[(int)eITEM.em_HP_POTION]         = GameObject.Find("HpPotionImg").gameObject;
        ItemImg[(int)eITEM.em_SPEED_POTION]      = GameObject.Find("SpdPotionImg").gameObject;
        ItemImg[(int)eITEM.em_DAMAGE_UP_POTIOM]  = GameObject.Find("AtkPotionImg").gameObject;
        ItemImg[(int)eITEM.em_DEFENCE_UP_POTION] = GameObject.Find("DefPotionImg").gameObject;
        for (int i = 0; i < 4; i++)
        {
            ItemImg[i].SetActive(false);
        }

        sound    = GameObject.Find("GameMgr").GetComponent <BgmController>();
        effSound = gameObject.GetComponentInChildren <EffSoundController>();
    }