Applies forces to attract/repulse against a point.

Inheritance: Effector2D
 static public int get_forceVariation(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.PointEffector2D self = (UnityEngine.PointEffector2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.forceVariation);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static public int set_forceSource(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.PointEffector2D     self = (UnityEngine.PointEffector2D)checkSelf(l);
         UnityEngine.EffectorSelection2D v;
         v = (UnityEngine.EffectorSelection2D)LuaDLL.luaL_checkinteger(l, 2);
         self.forceSource = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static public int set_angularDrag(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.PointEffector2D self = (UnityEngine.PointEffector2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.angularDrag = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
	// Use this for initialization
    protected override void Awake()
    {
        base.Awake();
		vfx = GetComponent<ParticleSystem>();
		coll = GetComponent<PolygonCollider2D>();
		effector = GetComponent<PointEffector2D>();
	}
    // Use this for initialization
    protected override void Awake()
    {
        base.Awake();
        vfx = GetComponent<ParticleSystem>();
        coll = GetComponent<CircleCollider2D>();
        effector = GetComponent<PointEffector2D>();
        render = GetComponent<MeshRenderer>();
	}
Beispiel #6
0
    public void Awake()
    {
        dieParticleSystem.Stop();
        explosionEffector = explosion.GetComponent<PointEffector2D>();
        explosionEffector.enabled = false;

        source = GetComponent<AudioSource>();
    }
    // Use this for initialization
    protected override void Awake()
    {
        base.Awake();
        vfx = GetComponent<ParticleSystem>();
        coll = GetComponent<CircleCollider2D>();
        effector = GetComponent<PointEffector2D>();
        render = GetComponent<MeshRenderer>();
        source = GetComponent<AudioSource>();

        render.sortingLayerName = Tags.SortingLayers.overlay;
    }
Beispiel #8
0
 static public int get_forceMode(IntPtr l)
 {
     try {
         UnityEngine.PointEffector2D self = (UnityEngine.PointEffector2D)checkSelf(l);
         pushEnum(l, (int)self.forceMode);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Beispiel #9
0
 static public int get_distanceScale(IntPtr l)
 {
     try {
         UnityEngine.PointEffector2D self = (UnityEngine.PointEffector2D)checkSelf(l);
         pushValue(l, self.distanceScale);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Beispiel #10
0
 static public int get_distanceScale(IntPtr l)
 {
     try {
         UnityEngine.PointEffector2D self = (UnityEngine.PointEffector2D)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.distanceScale);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #11
0
 static public int get_forceMode(IntPtr l)
 {
     try {
         UnityEngine.PointEffector2D self = (UnityEngine.PointEffector2D)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.forceMode);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.PointEffector2D o;
			o=new UnityEngine.PointEffector2D();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
 // Use this for initialization
 void Start () {
     playerHeart = GameObject.FindObjectOfType<PlayerHeart>();
     boomBitch = GetComponent<PointEffector2D>();
     fireAbilityParticle = GetComponent<ParticleSystem>();
     emission = fireAbilityParticle.emission;
     emission.enabled = false;
     boomBitch.enabled = false;
     firePlayer = GameObject.FindObjectOfType<Player>();
     fireBall = GameObject.FindObjectOfType<FireBall>();
     theGrad = fireAbilityParticle.colorOverLifetime;
     grads = GetComponent<FlickerGradients>();
 }
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.PointEffector2D o;
         o=new UnityEngine.PointEffector2D();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Beispiel #15
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.PointEffector2D o;
         o = new UnityEngine.PointEffector2D();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Beispiel #16
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.PointEffector2D o;
         o = new UnityEngine.PointEffector2D();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #17
0
 static public int set_distanceScale(IntPtr l)
 {
     try {
         UnityEngine.PointEffector2D self = (UnityEngine.PointEffector2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.distanceScale = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #18
0
 static public int set_forceMode(IntPtr l)
 {
     try {
         UnityEngine.PointEffector2D     self = (UnityEngine.PointEffector2D)checkSelf(l);
         UnityEngine.EffectorForceMode2D v;
         checkEnum(l, 2, out v);
         self.forceMode = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Beispiel #19
0
 static public int set_forceMode(IntPtr l)
 {
     try {
         UnityEngine.PointEffector2D     self = (UnityEngine.PointEffector2D)checkSelf(l);
         UnityEngine.EffectorForceMode2D v;
         checkEnum(l, 2, out v);
         self.forceMode = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #20
0
 static public int set_distanceScale(IntPtr l)
 {
     try {
         UnityEngine.PointEffector2D self = (UnityEngine.PointEffector2D)checkSelf(l);
         float v;
         checkType(l, 2, out v);
         self.distanceScale = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static void PointEffector2D_drag(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.PointEffector2D _this = (UnityEngine.PointEffector2D)vc.csObj;
         var result = _this.drag;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.PointEffector2D _this = (UnityEngine.PointEffector2D)vc.csObj;
         _this.drag = arg0;
     }
 }
 static void PointEffector2D_forceMode(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.PointEffector2D _this = (UnityEngine.PointEffector2D)vc.csObj;
         var result = _this.forceMode;
         JSApi.setEnum((int)JSApi.SetType.Rval, (int)result);
     }
     else
     {
         UnityEngine.EffectorForceMode2D arg0  = (UnityEngine.EffectorForceMode2D)JSApi.getEnum((int)JSApi.GetType.Arg);
         UnityEngine.PointEffector2D     _this = (UnityEngine.PointEffector2D)vc.csObj;
         _this.forceMode = arg0;
     }
 }
Beispiel #23
0
	// Use this for initialization
	void Start () {
		rg2d = GetComponent<Rigidbody2D> ();
		ef2d = GetComponent<PointEffector2D> ();
		rg2d.mass = 30;
		ef2d.forceMagnitude = -rg2d.mass*2;

        // instantiate the visibility of gravity fields
        field = Instantiate(Resources.Load("Gravity Field"), transform.position, transform.rotation) as GameObject;
        CircleCollider2D[] cc2d = ef2d.GetComponents<CircleCollider2D>();
        field.transform.localScale = field.transform.localScale * transform.localScale.x * cc2d[1].radius;

        if (gameObject.name == "StartPlanet")
        {
            Instantiate(Resources.Load("UFO"), transform.position + new Vector3(0, transform.localScale.x * 0.5f, 0), transform.rotation);
        }

    }
 /// <summary>
 /// Write the specified value using the writer.
 /// </summary>
 /// <param name="value">Value.</param>
 /// <param name="writer">Writer.</param>
 public override void Write(object value, ISaveGameWriter writer)
 {
     UnityEngine.PointEffector2D pointEffector2D = (UnityEngine.PointEffector2D)value;
     writer.WriteProperty("forceMagnitude", pointEffector2D.forceMagnitude);
     writer.WriteProperty("forceVariation", pointEffector2D.forceVariation);
     writer.WriteProperty("distanceScale", pointEffector2D.distanceScale);
     writer.WriteProperty("drag", pointEffector2D.drag);
     writer.WriteProperty("angularDrag", pointEffector2D.angularDrag);
     writer.WriteProperty("forceSource", pointEffector2D.forceSource);
     writer.WriteProperty("forceTarget", pointEffector2D.forceTarget);
     writer.WriteProperty("forceMode", pointEffector2D.forceMode);
     writer.WriteProperty("useColliderMask", pointEffector2D.useColliderMask);
     writer.WriteProperty("colliderMask", pointEffector2D.colliderMask);
     writer.WriteProperty("enabled", pointEffector2D.enabled);
     writer.WriteProperty("tag", pointEffector2D.tag);
     writer.WriteProperty("name", pointEffector2D.name);
     writer.WriteProperty("hideFlags", pointEffector2D.hideFlags);
 }
	void OnCollisionEnter2D(Collision2D coll) {
		if (coll.gameObject.tag.Equals ("Planet")) {
			Rigidbody2D coll_rg = coll.gameObject.GetComponent<Rigidbody2D> ();
			LastMassCenter = MassCenter;
			MassCenter = coll_rg.position;

			UFOEnableTouch = true;

            // grabs the rigidbody for planet landed on
            LastPlanet = CurrentPlanet;
            CurrentPlanet = coll.gameObject.GetComponent<PointEffector2D>();
            if (LastPlanet != null)
                LastPlanet.enabled = true;

            if (MassCenter != LastMassCenter) {
				if (stateMachine) {
					stateMachine.enterOrbit ();
				} else {
					Debug.Log ("State Machine does not exist");
					Application.Quit ();
				}
			}
		}
	}
 // Use this for initialization
 void Start()
 {
     effector = GetComponent<PointEffector2D>();
 }
        /// <summary>
        /// Read the data into the specified value.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <param name="reader">Reader.</param>
        public override void ReadInto(object value, ISaveGameReader reader)
        {
            UnityEngine.PointEffector2D pointEffector2D = (UnityEngine.PointEffector2D)value;
            foreach (string property in reader.Properties)
            {
                switch (property)
                {
                case "forceMagnitude":
                    pointEffector2D.forceMagnitude = reader.ReadProperty <System.Single> ();
                    break;

                case "forceVariation":
                    pointEffector2D.forceVariation = reader.ReadProperty <System.Single> ();
                    break;

                case "distanceScale":
                    pointEffector2D.distanceScale = reader.ReadProperty <System.Single> ();
                    break;

                case "drag":
                    pointEffector2D.drag = reader.ReadProperty <System.Single> ();
                    break;

                case "angularDrag":
                    pointEffector2D.angularDrag = reader.ReadProperty <System.Single> ();
                    break;

                case "forceSource":
                    pointEffector2D.forceSource = reader.ReadProperty <UnityEngine.EffectorSelection2D> ();
                    break;

                case "forceTarget":
                    pointEffector2D.forceTarget = reader.ReadProperty <UnityEngine.EffectorSelection2D> ();
                    break;

                case "forceMode":
                    pointEffector2D.forceMode = reader.ReadProperty <UnityEngine.EffectorForceMode2D> ();
                    break;

                case "useColliderMask":
                    pointEffector2D.useColliderMask = reader.ReadProperty <System.Boolean> ();
                    break;

                case "colliderMask":
                    pointEffector2D.colliderMask = reader.ReadProperty <System.Int32> ();
                    break;

                case "enabled":
                    pointEffector2D.enabled = reader.ReadProperty <System.Boolean> ();
                    break;

                case "tag":
                    pointEffector2D.tag = reader.ReadProperty <System.String> ();
                    break;

                case "name":
                    pointEffector2D.name = reader.ReadProperty <System.String> ();
                    break;

                case "hideFlags":
                    pointEffector2D.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> ();
                    break;
                }
            }
        }
 /// <summary>
 /// Read the data using the reader.
 /// </summary>
 /// <param name="reader">Reader.</param>
 public override object Read(ISaveGameReader reader)
 {
     UnityEngine.PointEffector2D pointEffector2D = SaveGameType.CreateComponent <UnityEngine.PointEffector2D> ();
     ReadInto(pointEffector2D, reader);
     return(pointEffector2D);
 }
Beispiel #29
0
    /// <summary>
    /// Initialize
    /// </summary>
    void Start()
    {
        rb = GetComponent<Rigidbody2D> ();
        pe = GetComponent<PointEffector2D> ();
        cc = GetComponent<CircleCollider2D> ();
        animator = GetComponent<Animator> ();
        audioSource = GetComponent<AudioSource> ();
        sc = GameObject.FindGameObjectWithTag ("SceneController").GetComponent<SceneController> ();
        ChangeVol ();

        //Check for one or two controller input
        if (fireButton == "FireAlt") {
            thrustButton = "ThrustAlt";
            boostButton = "BoostAlt";
            horizAxis = "HorizontalAlt";
            vertAxis = "VerticalAlt";
        }

        if (GameObject.FindGameObjectWithTag ("GameController") != null) {
            gc = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
        }

        //checking for AI
        enemyAI = this.gameObject.GetComponent<EnemyAI>();
    }
Beispiel #30
0
    // Use this for initialization
    void Start()
    {
        this.transform.parent = GameObject.Find("Asteroids").transform;
        rotateSpeed *= Random.Range(0.0f, 1.0f);
        if (this.gameObject == tinyAsteroid)
        {
            Destroy(this.gameObject, tinyAsteroidDestroyTime);
        }
        pe = GetComponent<PointEffector2D> ();

        //		GameObject.Find("GameController").GetComponent<GameController>().SpawnerList.Add(this.gameObject);
    }
    static int _CreatePointEffector2D(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            PointEffector2D obj = new PointEffector2D();
            LuaScriptMgr.Push(L, obj);
            return 1;
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: PointEffector2D.New");
        }

        return 0;
    }
 void Awake()
 {
     circleCol = GetComponent<CircleCollider2D>();
     pe = GetComponent<PointEffector2D>();
 }