コード例 #1
0
 public override void OnCrystalUse(Side side, bool active)
 {
     staffActive = active;
     if (active)
     {
         staffEffect = chargeEffectData.Spawn(imbue.colliderGroup.imbueShoot.position, Quaternion.identity);
         staffEffect.SetSource(imbue.colliderGroup.imbueShoot);
         staffEffect.SetParent(imbue.colliderGroup.collisionHandler.item.transform);
         ((EffectVfx)staffEffect.effects.Find(effect => effect is EffectVfx)).vfx.SetInt("State", 1);
         staffEffect.Play();
         Player.currentCreature.mana.StartCoroutine(StaffCoroutine());
     }
     else
     {
         if (previousItems != null)
         {
             previousItems.ForEach(item => item?.HeldItem().Reset(CastSource.Staff));
         }
         if (items != null)
         {
             items.ForEach(item => item?.HeldItem()?.Reset(CastSource.Staff));
         }
         staffEffect?.Stop();
         Throw(imbue.colliderGroup.collisionHandler.item.rb.GetPointVelocity(imbue.colliderGroup.imbueShoot.position), CastSource.Staff);
     }
     base.OnCrystalUse(side, active);
 }
コード例 #2
0
 public override void Update()
 {
     base.Update();
     if (effectShown)
     {
         textObject.SetActive(true);
         ringEffect.SetSpeed(GetHandDistanceInGs());
         ringEffect.SetIntensity(GetHandDistanceInGs());
         lineEffect.SetSource(Player.currentCreature.handLeft.caster.magicSource);
         lineEffect.SetTarget(Player.currentCreature.handRight.caster.magicSource);
         Player.currentCreature.mana.mergePoint.transform.rotation = GetHandsPointingQuaternion();
         text.text = $"{Math.Round(GetHandDistanceInGs(), 1)}G";
         textObject.transform.position = Vector3.Lerp(
             textObject.transform.position,
             Player.currentCreature.mana.mergePoint.transform.position + new Vector3(0, 0.2f, 0),
             Time.deltaTime * 50.0f);
         textObject.transform.rotation = Quaternion.LookRotation(textObject.transform.position - Player.currentCreature.animator.GetBoneTransform(HumanBodyBones.Head).position);
     }
     else
     {
         textObject.SetActive(false);
     }
 }