private void RecuedNpc() { m_NPCPlayer.transform.SetParent(Global.gApp.gBulletNode.transform); if (!m_ForceTrapState) { m_NPCPlayer.SetBehavior(FightNpcPlayer.NpcBehaviorType.Rescued); } m_NPCPlayer.transform.position = transform.position; Player player = Global.gApp.CurScene.GetMainPlayerComp(); if (player != null) { player.GetPlayerData().AddDropRes(m_Npc.ToString(), 1); BroadGainProp(); } Global.gApp.CurScene.GetPropMgr().RemoveProp(gameObject); }
void GenerateNpc() { m_HasGenerateNpc = true; string npcPath = "Prefabs/Campsite/NpcFight/" + m_Npc.ToString(); GameObject Npc_boy = Global.gApp.gResMgr.InstantiateObj(npcPath); FightNpcPlayer npcPlayer = Npc_boy.GetComponent <FightNpcPlayer>(); if (!m_ForceTrapState) { Npc_boy.transform.localEulerAngles = new Vector3(0, 0, Random.Range(0, 360)); } m_NPCPlayer = npcPlayer; npcPlayer.Init(null); m_NPCPlayer.transform.SetParent(transform); m_NPCPlayer.transform.position = transform.position; m_NPCPlayer.SetBehavior(FightNpcPlayer.NpcBehaviorType.Trapped); m_NPCPlayer.FreshProgress(0); m_CircleEffect = Global.gApp.gResMgr.InstantiateObj(EffectConfig.NpcRecycleEffect); m_CircleEffect.transform.SetParent(transform, false); m_CircleEffect.transform.localPosition = Vector3.zero; }