示例#1
0
 public override void Merge(bool active)
 {
     base.Merge(active);
     if (active)
     {
         if (!isActive)
         {
             isActive = true;
             sunData.SpawnAsync(sun => {
                 sunInstance = sun;
                 sunInstance.transform.position        = Player.currentCreature.mana.mergePoint.transform.position;
                 sunInstance.transform.rotation        = Player.currentCreature.mana.mergePoint.transform.rotation;
                 sunInstance.rb.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
                 sunInstance.rb.isKinematic            = true;
                 SunController control = sunInstance.GetComponent <SunController>();
                 control.mergeSpell    = this;
             });
         }
     }
     else
     {
         isActive = false;
         Vector3 velocity = Player.local.transform.rotation * PlayerControl.GetHand(GameManager.options.twoHandedDominantHand).GetHandVelocity();
         if (currentCharge == 1)
         {
             Throw(velocity);
         }
         else if (sunInstance != null)
         {
             sunInstance.GetComponent <SunController>().Despawn();
             sunInstance = null;
         }
     }
 }
示例#2
0
        public void Throw(Vector3 velocity)
        {
            SunController control = sunInstance.GetComponent <SunController>();

            if (control != null)
            {
                control.active        = true;
                control.numFireballs  = sunNumFireballs;
                control.fireballDelay = sunFireballDelay;
            }
            sunInstance.rb.isKinematic = false;
            sunInstance.rb.useGravity  = true;
            sunInstance.rb.AddForce(velocity * throwVelocity, ForceMode.Impulse);
            sunInstance.Throw();
        }