protected override void Awake() { base.Awake(); attackTrail = Visual.GetComponentInChildren <MeleeWeaponTrail>(); //attackTrail.Emit = false; }
IEnumerator CreateWeaponCour(int index) { ITEM.Item item = InventorySystem.instance.GetItemFromInventory(ItemType.TYPE_WEAPON, index - 1); Transform tr = (hasWeapon) ? player.rightHandBone.transform : player.backBone.transform; weapon = Instantiate(Resources.Load("Prefabs/" + item.itemData.Name), tr) as GameObject; if (hasWeapon == false && isPick == false) { weapon.transform.parent = player.backBone.transform; weapon.transform.localPosition = posOffsetBack; weapon.transform.localRotation = rotOffsetBack; } else { weapon.transform.parent = player.rightHandBone.transform; weapon.transform.localPosition = posOffsetRight; weapon.transform.localRotation = rotOffsetRight; } //Destroy(weapon.GetComponent<Rigidbody>()); weapon.GetComponent <Rigidbody>().isKinematic = true; weapon.GetComponent <BoxCollider>().isTrigger = true; weapon.GetComponent <BoxCollider>().enabled = false; // 무기는 휘두를때만 콜리더 킴 weapon.GetComponent <WeaponComponent>().weaponItem.itemData = item.itemData; //weaponType = weapon.GetComponent<WeaponComponent>().weaponItem.weaponType; weapon.GetComponent <WeaponComponent>().isUsing = false; trail = weapon.GetComponent <MeleeWeaponTrail>(); // 현재 무기의 트레일 이펙트에 접근 weapon.GetComponentInChildren <ParticleSystem>().Stop(); yield return(null); }
public AudioClip playerDeadSound; //主角死亡声音 //private Transform playerCamera;//主角摄像机 //private AttachCamera cameraShake; void Awake() { sword = GameObject.FindGameObjectWithTag(Tags.sword).transform; //获取刀 weaponTrail = sword.gameObject.GetComponent <MeleeWeaponTrail>(); //获取武器拖尾脚本 //playerCamera = GameObject.FindWithTag(Tags.playerCamera).transform; //cameraShake = playerCamera.gameObject.GetComponent<AttachCamera>(); }
private void Awake() { InitCollider(); m_meleeTrail = GetComponent <MeleeWeaponTrail>(); if (m_meleeTrail != null) { m_meleeTrail.Emit = false; } }
// Start void Start() { duration = skillStage.attackAnimDuration; trail = caster.weaponModel.GetComponent<MeleeWeaponTrail>(); Invoke("StartMeleeAttack", startDelay); Invoke("StopMeleeAttack", duration); }
// Start void Start() { duration = skillStage.attackAnimDuration; trail = caster.weaponModel.GetComponent <MeleeWeaponTrail>(); Invoke("StartMeleeAttack", startDelay); Invoke("StopMeleeAttack", duration); }
public override void onAttackAction() //timeLength是持续时间 { if (theEffectForKnife == null) { theEffectForKnife = this.GetComponentInChildren <MeleeWeaponTrail> (); } if (theAnimator == null) { theAnimator = this.GetComponentInChildren <Animator> (); } keepTimer = keepTimerMax;//每一次激活都增加一点时间 theEffectForKnife.Use = true; }
// Use this for initialization void Start( ) { m_skillManager = GetComponent <SkillManager>(); m_animator = GetComponent <Animator>(); m_agent = GetComponent <NavMeshAgent>(); m_ctrled = GetComponent <Controlled>(); m_baseMoveSpeed = m_agent.speed; if (isMelee) { m_meleeWeaponTrail = GetComponentInChildren <MeleeWeaponTrail>(); } PlayerData.GetInstance().action = this; }
public virtual void Start() { anim = GetComponent <Animator> (); weapon = GetComponent <HeroInit> ().weaponCollider; weaponTrail = GetComponentInChildren <MeleeWeaponTrail> (); foreach (var item in anim.runtimeAnimatorController.animationClips) { if (!Filter(item.name)) { AddEvent(item, "OnAnimationStart", 0); AddEvent(item, "OnAnimationEnd", item.length); } } }
void Start() { m_animator = GetComponent <Animator>(); // 컴포넌트에서 애니메이터를 동기화 m_weaponCollider = GameObject.Find("Dragonblade").GetComponent <Collider>(); // 대검 오브젝트의 이름을 찾은 후 콜라이더 동기화 m_cameraScript = GameObject.Find("Main Camera").GetComponent <FollowCam>(); m_baseSlashTrail = m_weaponCollider.transform.Find("TrailEffect").GetComponent <MeleeWeaponTrail>(); m_baseSlashTrail._lifeTime = 0.0f; // 모든 이펙트는 초기에 꺼둔다. m_rushEffect.Stop(); m_leafAttackRangeEffect.Stop(); m_swordWindChargeEffect.Stop(); m_levelUpEffect.Stop(); m_flashEffect.Stop(); }
public float hitAreaVertical; // 공격 z축 범위 // Start is called before the first frame update override protected void Start() { base.Start(); meleeWeaponTrail = swingArea.GetComponent <MeleeWeaponTrail>(); }
void Awake () { sword = GameObject.Find ("Sword").transform; weaponTrail = sword.gameObject.GetComponent<MeleeWeaponTrail> (); audioSource = GetComponent<AudioSource> (); }
// Use this for initialization void Start() { weapon = GetComponentInChildren <WeaponColliderBasic>(); weaponTrail = GetComponentInChildren <MeleeWeaponTrail>(); }
// Use this for initialization void Start( ) { m_skillManager = GetComponent<SkillManager>(); m_animator = GetComponent<Animator>(); m_agent = GetComponent<NavMeshAgent>(); m_ctrled = GetComponent<Controlled>(); m_baseMoveSpeed = m_agent.speed; if (isMelee) { m_meleeWeaponTrail = GetComponentInChildren<MeleeWeaponTrail>(); } PlayerData.GetInstance().action = this; }
// Use this for initialization void Start( ) { m_meleeWeaponTrail = GetComponentInChildren <MeleeWeaponTrail>(); m_animator = GetComponent <Animator>(); }
private static void GenerateReferenceLists() { //Start surfing through all items foreach (GameObject go in ObjectDB.instance.m_items) { //Add to reference lists if not in their already MyReferences.TryAddToItemList(go); ItemDrop id = go.GetComponent <ItemDrop>(); if (id != null) { //var s = id.m_itemData.m_shared; //Log.LogMessage($"{id.name},{s.m_weight},{s.m_attackForce}"); ParticleSystemRenderer ps = go.GetComponent <ParticleSystemRenderer>(); if (ps != null) { if (!MyReferences.listOfMaterials.ContainsKey("item_particle".GetStableHashCode())) { MyReferences.TryAddToMaterialList(ps.sharedMaterial, "item_particle"); } } var shared = id.m_itemData.m_shared; //Start looking for weapon effects (fx, sfx, vfx) if (shared.m_itemType == ItemDrop.ItemData.ItemType.OneHandedWeapon || shared.m_itemType == ItemDrop.ItemData.ItemType.TwoHandedWeapon || shared.m_itemType == ItemDrop.ItemData.ItemType.Bow) { if (!MyReferences.listOfMaterials.ContainsKey("club_trail".GetStableHashCode())) { Transform thing = RecursiveSearchFunctions.ChildNodeFinderBreadthFirst(go.transform, "attach"); if (thing != null) { thing = RecursiveSearchFunctions.ChildNodeFinderBreadthFirst(thing, "equiped"); if (thing != null) { Transform trail = RecursiveSearchFunctions.ChildNodeFinderDepthFirst(thing, "trail"); if (trail != null) { MeleeWeaponTrail mwt = trail.gameObject.GetComponent <MeleeWeaponTrail>(); MyReferences.TryAddToMaterialList(mwt._material, "club_trail"); } } } } MyReferences.TryExtractEffectsFromItemDropShared(shared); } //Check to see if item can also build things if (shared.m_buildPieces != null) { var pieceTable = shared.m_buildPieces.m_pieces; if (pieceTable != null) { foreach (var pieceTableItem in pieceTable) { MyReferences.TryAddToPieceList(pieceTableItem); //One off capture of a station extension's line effect StationExtension stationExtension = pieceTableItem.GetComponent <StationExtension>(); if (stationExtension != null && !MyReferences.listOfEffects.ContainsKey(stationExtension.m_connectionPrefab.name.GetStableHashCode())) { MyReferences.listOfEffects.Add(stationExtension.m_connectionPrefab.name.GetStableHashCode(), stationExtension.m_connectionPrefab); } //Collect this for items and pieces, for proper referencing CraftingStation craftingStation = pieceTableItem.GetComponent <CraftingStation>(); if (craftingStation != null && !MyReferences.listOfCraftingStations.ContainsKey(pieceTableItem.name.GetStableHashCode())) { MyReferences.listOfCraftingStations.Add(pieceTableItem.name.GetStableHashCode(), craftingStation); } CookingStation cookingStation = pieceTableItem.GetComponent <CookingStation>(); if (cookingStation != null && !MyReferences.listOfCookingStations.ContainsKey(pieceTableItem.name.GetStableHashCode())) { MyReferences.listOfCookingStations.Add(pieceTableItem.name.GetStableHashCode(), cookingStation); } //Extracting any Piece Placement Effects var PieceScript = pieceTableItem.GetComponent <Piece>(); if (PieceScript != null) { ExtractEffectsFromPiece(PieceScript.m_placeEffect); } //Extracting WearNTear effects var WearNTearScript = pieceTableItem.GetComponent <WearNTear>(); if (WearNTearScript != null) { ExtractEffectsFromPiece(WearNTearScript.m_destroyedEffect); ExtractEffectsFromPiece(WearNTearScript.m_hitEffect); ExtractEffectsFromPiece(WearNTearScript.m_switchEffect); } } } } } } }
void Awake() { bossSwordTrail = bossSword.gameObject.GetComponent <MeleeWeaponTrail>(); }
public void ApplyEffects(GameObject gameObject) { //Set item particle material //try //{ // gameObject.GetComponent<ParticleSystemRenderer>().material = AssetReferences.listOfMaterials["item_particle"]; //} //catch (Exception e) //{ // Plugin.Log.LogError($"Error getting item spark particle effect material from material list"); // Plugin.Log.LogError($"Catch Exception details: {e.Message} --- {e.StackTrace}"); //} ParticleSystemRenderer ps = gameObject.GetComponent <ParticleSystemRenderer>(); if (ps != null) { ps.sharedMaterial = MyReferences.listOfMaterials["item_particle".GetStableHashCode()]; } Transform thing = RecursiveSearchFunctions.ChildNodeFinderBreadthFirst(gameObject.transform, "attach"); if (thing != null) { thing = RecursiveSearchFunctions.ChildNodeFinderBreadthFirst(thing, "equiped"); if (thing != null) { Transform trail = RecursiveSearchFunctions.ChildNodeFinderDepthFirst(thing, "trail"); if (trail != null) { MeleeWeaponTrail mwt = trail.gameObject.GetComponent <MeleeWeaponTrail>(); mwt._material = MyReferences.listOfMaterials["club_trail".GetStableHashCode()]; } } } var gameObjectShared = gameObject.GetComponent <ItemDrop>().m_itemData.m_shared; if (pendingStatusEffects.Count > 0) { try { foreach (PendingStatusEffect pendingStatusEffect in pendingStatusEffects) { StatusEffect EffectToApply = null; GameObject targetPrefab = null; if (pendingStatusEffect.targetFrom != StatusEffectTarget.ODB) { targetPrefab = MyReferences.listOfAllGameObjects[pendingStatusEffect.prefabTarget.GetStableHashCode()]; if (targetPrefab == null) { targetPrefab = ObjectDB.instance.GetItemPrefab(pendingStatusEffect.prefabTarget); } if (targetPrefab == null) { continue; } } switch (pendingStatusEffect.targetFrom) { case StatusEffectTarget.ODB: EffectToApply = ObjectDB.instance.GetStatusEffect(pendingStatusEffect.prefabTarget); break; case StatusEffectTarget.SET: EffectToApply = targetPrefab.GetComponent <ItemDrop>().m_itemData.m_shared.m_setStatusEffect; break; case StatusEffectTarget.EQUIP: EffectToApply = targetPrefab.GetComponent <ItemDrop>().m_itemData.m_shared.m_equipStatusEffect; break; case StatusEffectTarget.ATTACK: EffectToApply = targetPrefab.GetComponent <ItemDrop>().m_itemData.m_shared.m_attackStatusEffect; break; } if (EffectToApply != null) { switch (pendingStatusEffect.targetTo) { case StatusEffectTarget.SET: gameObjectShared.m_setStatusEffect = EffectToApply; break; case StatusEffectTarget.EQUIP: gameObjectShared.m_equipStatusEffect = EffectToApply; break; case StatusEffectTarget.ATTACK: gameObjectShared.m_attackStatusEffect = EffectToApply; break; } } } } catch (Exception e) { Plugin.Log.LogError($"Error Trying to fix status effect reference {e.Message}"); } } if (pendingEffects.Count > 0) { //Set item attack trail material //try //{ // PrefabNodeManager.RecursiveChildNodeFinder(gameObject.transform, "trail").gameObject.GetComponent<MeleeWeaponTrail>()._material = AssetReferences.listOfMaterials["club_trail"]; //} //catch (Exception e) //{ // Plugin.Log.LogError($"Error getting weapon trail effect material from material list"); // Plugin.Log.LogError($"Catch Exception details: {e.Message} --- {e.StackTrace}"); //} foreach (PendingEffect pendingEffect in pendingEffects) { EffectData effectData = new EffectData(); effectData.m_enabled = true; try { effectData.m_prefab = MyReferences.listOfEffects[pendingEffect.effectName.GetStableHashCode()]; } catch (Exception e) { Plugin.Log.LogError($"Error getting effect {pendingEffect.effectName} from effect list"); Plugin.Log.LogError($"Catch Exception details: {e.Message} --- {e.StackTrace}"); } switch (pendingEffect.list) { case EffectList.HIT: hitEffectsData.Add(effectData); break; case EffectList.HIT_TERRAIN: hitterrainEffectsData.Add(effectData); break; case EffectList.BLOCK: blockEffectsData.Add(effectData); break; case EffectList.START: startEffectsData.Add(effectData); break; case EffectList.HOLD: holdEffectsData.Add(effectData); break; case EffectList.TRIGGER: triggerEffectsData.Add(effectData); break; case EffectList.TRAIL: trailEffectsData.Add(effectData); break; } } } gameObjectShared.m_hitEffect.m_effectPrefabs = hitEffectsData.ToArray(); gameObjectShared.m_hitTerrainEffect.m_effectPrefabs = hitterrainEffectsData.ToArray(); gameObjectShared.m_blockEffect.m_effectPrefabs = blockEffectsData.ToArray(); gameObjectShared.m_startEffect.m_effectPrefabs = startEffectsData.ToArray(); gameObjectShared.m_holdStartEffect.m_effectPrefabs = holdEffectsData.ToArray(); gameObjectShared.m_triggerEffect.m_effectPrefabs = triggerEffectsData.ToArray(); gameObjectShared.m_trailStartEffect.m_effectPrefabs = trailEffectsData.ToArray(); WipeLists(); }
void Awake () { audioSource = GetComponent<AudioSource> (); swordTrail = sword.GetComponent<MeleeWeaponTrail> (); }
void Start() { melee = GetComponent <MeleeWeaponTrail>(); }
//CharacterController ctrller; public override void Awake() { base.Awake(); weaponTrail = GetComponentInChildren <MeleeWeaponTrail> (); //ctrller = GetComponent<CharacterController> (); }