コード例 #1
0
        private Vector2 angleToPercentage()
        {
            int   globalDirection = (transform.lossyScale.x < 0) ? -1 : 1;
            float angle           = Mathf.Abs(transform.rotation.eulerAngles.z); //absolute value fixes negative value at -360

            return(CalcObject.RotationToShotVector(angle) * globalDirection);
        }
コード例 #2
0
        private void movement()
        {
            reAngle.RunOnce(ReAngleTime);

            if (reAngle.Flag)
            {
                if (reAngleTriggered)
                {
                    return;
                }

                float angle = Emitter.transform.rotation.eulerAngles.z - vertMod;
                angle += (angle < 0) ? 360 : 0;

                float embellish = Embellish;
                embellish = (angle < 180) ? embellish * -1 : embellish;

                if (Emitter.transform.lossyScale.x < 0)
                {
                    embellish -= 180;
                }

                Trajectory         = CalcObject.RotationToShotVector(embellish + vertMod);
                transform.rotation = Quaternion.AngleAxis(embellish + vertMod, Vector3.forward);

                reAngleTriggered = true;
            }
        }
コード例 #3
0
 private void resetLinearAngle()
 {
     if (!resetSwitch && assigned)
     {
         float angle = CalcObject.AngleBetweenVectors(transform.position, lastKnownPos);
         Trajectory  = CalcObject.RotationToShotVector(angle);
         resetSwitch = true;
     }
 }
コード例 #4
0
        private void burst()
        {
            burstTimer.Run(BurstFrequency);

            if (burstTimer.Flag)
            {
                body.AddForce(CalcObject.RotationToShotVector(transform.rotation.eulerAngles.z) * ShotSpeed / 5, ForceMode2D.Impulse);
            }

            burstFlag = burstTimer.Flag;
        }