protected void Awake() { thisStick = GetComponent <Item>(); if (stickOne == null) { stickOne = thisStick; } else if (stickTwo == null) { stickTwo = thisStick; } else { Debug.LogError("ERROR: More than two sticks are spawned. Some features will not work."); } thisStick.OnCollisionEvent += OnEscrimaCollision; module = thisStick.data.GetModule <ItemModuleEscrimaLightning>(); boltScript = thisStick.GetComponentInChildren <LightningBoltPathScript>(); bolts = new List <LightningBoltPathScript>(); contactObject = new GameObject(); beamsSound = thisStick.transform.Find("Lightning").GetComponentInChildren <AudioSource>(); beamsSound.transform.parent = contactObject.transform; }
private void LightningFX(Vector3 targetPosition, Creature target) { LightningBoltPathScript bolt = Instantiate(boltScript); GameObject startObject = Instantiate(contactObject); startObject.transform.parent = contactObject.transform; GameObject targetObject = new GameObject(); targetObject.transform.position = targetPosition; targetObject.transform.parent = target.ragdoll.GetPart(HumanBodyBones.Chest).transf; List <GameObject> path = new List <GameObject>(); path.Add(startObject); path.Add(targetObject); bolt.LightningPath = path; bolts.Add(bolt); }