private static void CreateHoverTrigger2D(GameObject cgf = null, CircularGravity2D circularGravity = null)
        {
            GameObject triggerEnableObj = new GameObject();

            triggerEnableObj.name = "Trigger Hover";
            if (circularGravity != null)
            {
                triggerEnableObj.AddComponent <CGF_HoverTrigger2D>().Cgf = circularGravity;
            }
            else
            {
                triggerEnableObj.AddComponent <CGF_HoverTrigger2D>();
            }
            if (cgf != null)
            {
                triggerEnableObj.transform.SetParent(cgf.transform, false);
            }
            triggerEnableObj.transform.position = triggerEnableObj.transform.position + new Vector3(0, -6f);
            triggerEnableObj.transform.rotation = Quaternion.Euler(0, 0, 180f);

            if (cgf == null)
            {
                FocusGameObject(triggerEnableObj, true);
            }
        }
示例#2
0
        void Start()
        {
            cgf = this.GetComponent <CircularGravity2D>();

            if (_pulseProperties.Pulse)
            {
                cgf.Size       = _pulseProperties.MinSize;
                pulse_Positive = true;
            }
        }
示例#3
0
        void Awake()
        {
            cgf = this.GetComponent <CircularGravity2D>();

            SetIdleValues();
        }
        private void UpdateCGF2DGUI()
        {
            if (buttonCreate2D)
            {
                //Creates empty gameobject.
                GameObject cgf = new GameObject();

                //Creates Circular Gravity Force component
                CircularGravity2D circularGravity = cgf.AddComponent <CircularGravity2D>();

                //Adds Controls
                if (modAxisControls2D)
                {
                    cgf.AddComponent <CGF_AxisControls2D>();
                }

                if (modKeyControls2D)
                {
                    cgf.AddComponent <CGF_KeyControls2D>();
                }

                //Adds Mods
                if (modPulse2D)
                {
                    cgf.AddComponent <CGF_Pulse2D>();
                }
                if (modSize2D)
                {
                    cgf.AddComponent <CGF_SizeByRaycast2D>();
                }

                //Sets up properties
                circularGravity._shape2D     = cgfShape2D;
                circularGravity._forceType2D = cgfForceType2D;
                circularGravity.ForcePower   = cgfForcePower2D;
                circularGravity._forceMode2D = cgfForceMode2D;
                circularGravity.Size         = cgfSize2D;
                circularGravity._constraintProperties.AlignToForce = cgfAlignToForce2D;
                circularGravity._constraintProperties.SlerpSpeed   = cgfslerpSpeed2D;

                circularGravity._drawGravityProperties.DrawGravityForce    = cgfDrawGravityForce2D;
                circularGravity._drawGravityProperties.GravityLineMaterial = new Material(Shader.Find("UI/Default"));
                circularGravity._drawGravityProperties.Thickness           = cgfDrawGravityForceThickness2D;

                //Sets gameojbect Name
                cgf.name = "CGF 2D";

                FocusGameObject(cgf, true);

                if (triggerEnable2D)
                {
                    CreateEnableTrigger2D(cgf, circularGravity);
                }
                if (triggerHover2D)
                {
                    CreateHoverTrigger2D(cgf, circularGravity);
                }

                //Disables the buttonCreateNewCGF
                buttonCreate2D = false;
            }
        }
示例#5
0
        // Use this for initialization
        void Start()
        {
            cgf = this.GetComponent <CircularGravity2D>();

            cgf.Size = maxCgfSize;
        }