private void Awake() { distortionEffect = GetComponent <_2dxFX_Distortion_Additive>(); AdjustRadius(); warningColor = new Color32(255, 0, 63, 255); particleSystemGameObjectsToScale.Add(standardStarParticlesGO); particleSystemGameObjectsToScale.Add(starTooBigGO); particleSystemGameObjectsToScale.Add(starUltraNovaGO); doomColor = Color.red; playerHealth = GameObject.Find("Player").GetComponent <PlayerHealth>(); illuminationLossLap = 30.0f; holdMaxIlluminationDuration = 30.0f; blackHoleEffect = GetComponent <_2dxFX_BlackHole>(); blackHoleForce = GetComponent <PointEffector2D>(); area = GetComponent <CircleCollider2D>(); DarkStarSprite = GetComponent <SpriteRenderer>().sprite; // openStarParticles = openStarGO.GetComponentsInChildren<ParticleSystem>().ToList(); ourAnimations = GetComponent <DarkStarAnimations>(); // maxIlluminationParticles = maxIlluminationGO.GetComponentsInChildren<ParticleSystem>().ToList(); //here we're connecting it so that when it touches the rim of being too big, it starts a countdown DarkStarTooBig.DarkStarReachedTooLargeBounds += BeginOvercharge; DarkStarTooBig.DarkStarReceeded += this.CancelOvercharge; DarkStarTooBig.DarkStarReachedTooLargeBounds += StartDistortionEffect; DarkStarTooBig.DarkStarReceeded += this.StopDistortionEffect; }
protected override void OnValidate() { base.OnValidate(); invuln = true; cc2Ds = GetComponentsInChildren <CircleCollider2D>(); ps = GetComponent <ParticleSystem>(); pe2D = GetComponentInChildren <PointEffector2D>(); foreach (CircleCollider2D cc2D in cc2Ds) { if (cc2D.isTrigger) // area effect { cc2D.radius = areaEffectRadius; } else // singularity { cc2D.radius = singularityRadius; } } sRend.transform.localScale = new Vector3(2 * singularityRadius, 2 * singularityRadius, 1f); pe2D.forceMagnitude = forceMagnitude; if (ps) { // arbitrary ParticleSystem.ShapeModule pss = ps.shape; pss.radius = (singularityRadius + areaEffectRadius) / 2f; pss.radiusThickness = 1 - singularityRadius / pss.radius; // delete particles inside the singularity ps.trigger.SetCollider(0, cc2Ds[0]); } }
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() { PointEffector2D effector = GetComponent <PointEffector2D> (); float f = Random.Range(ForceMin, ForceMax); effector.forceMagnitude = f; }
// Use this for initialization protected override void Awake() { base.Awake(); vfx = GetComponent <ParticleSystem>(); coll = GetComponent <CircleCollider2D>(); effector = GetComponent <PointEffector2D>(); }
void Start() { gun = GetComponent <Gun>(); rb = GetComponent <Rigidbody2D>(); gravityEffector = GetComponent <PointEffector2D>(); gravityEffector.enabled = false; }
void pointEffect() { foreach (Collider2D collider in colliderList) { PointEffector2D effector = collider.GetComponent <PointEffector2D>(); if (Input.GetKey(KeyCode.Mouse0)) { effector.forceMagnitude = pointEffectForce; GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0); hasSetEffector = true; } else if (Input.GetKey(KeyCode.Mouse1)) { effector.forceMagnitude = pointEffectForce * -1; GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0); hasSetEffector = true; } else { effector.forceMagnitude = 0; hasSetEffector = false; } } if (!colliderList[0].transform.position.Equals(controls.positions[0])) { colliderList[1].gameObject.SetActive(true); colliderList[1].transform.position = controls.positions[0]; colliderList.Reverse(); } else { colliderList[1].gameObject.SetActive(false); } }
public void Step(Ball bal) { Collider2D[] cols2 = Physics2D.OverlapCircleAll(bal.transform.position, radius); foreach (Collider2D col in cols2) { if (col.usedByEffector) { PointEffector2D effector = col.GetComponent <PointEffector2D>(); Vector2 dir = new Vector2(effector.transform.position.x - bal.transform.position.x, effector.transform.position.y - bal.transform.position.y); float distSqr = dir.magnitude * effector.distanceScale; if (effector.forceMode == EffectorForceMode2D.InverseSquared) { distSqr *= distSqr; } float force = effector.forceMagnitude / (distSqr); float vel = (force / bal.mass); vel *= Time.fixedDeltaTime; bal.velocity += -dir.normalized * vel; } } if (bal.drag != 0) { bal.velocity *= (1f - (Time.fixedDeltaTime * bal.drag)); } bal.transform.position += (bal.velocity * Time.fixedDeltaTime).XYZ(0); }
void Start() { //Inicializamos los componentes anteriores y desactivamos el "point effector" en un principio anim = GetComponent <Animator>(); pe = GetComponent <PointEffector2D>(); pe.enabled = false; }
// Start called at the start protected void Start() { pointEffector = GetComponent <PointEffector2D>(); particles = GetComponent <ParticleSystem>(); spriteRenderer = GetComponent <SpriteRenderer>(); //oldSprite = GetComponent<Sprite>(); }
public void Die() { if (type == "Droid") { GetComponent <EnemyMovement>().state = "Idle"; GetComponent <Enemy1_Attack>().enabled = false; } if (type == "Drone") { GetComponent <DroneMovement>().enabled = false; GetComponent <DroneAttack>().enabled = false; } if (type == "Drone2") { GetComponent <DroneMovement>().enabled = false; Destroy(GetComponent <Drone2Attack>().cp); GetComponent <Drone2Attack>().enabled = false; } if (type == "LandMine") { GetComponent <LandMine>().delay = 0; GetComponent <LandMine>().explode = true; } //Rigidbody2D rb = GetComponent<Rigidbody2D>(); //rb.velocity = new Vector2(0, 0); //rb.simulated = false; if (corpse != null) { foreach (GameObject bodyPart in corpse) { //bodyPart.GetComponent<Rigidbody2D>().velocity = new Vector2(Random.Range(-corpseExplosionForce, corpseExplosionForce), Random.Range(-corpseExplosionForce, corpseExplosionForce)); Instantiate(bodyPart, transform.position + new Vector3(Random.Range(-corpseSpawnOffset, corpseSpawnOffset), Random.Range(-corpseSpawnOffset, corpseSpawnOffset), 0.0f), Quaternion.identity); } } if (explodeOnDeath) { GameObject thisExplosion = explosion; CircleCollider2D thisCollider = thisExplosion.GetComponent <CircleCollider2D>(); PointEffector2D thisEffector = thisExplosion.GetComponent <PointEffector2D>(); thisCollider.radius = explosionRadius; thisEffector.forceMagnitude = explosionForce; thisExplosion.GetComponent <Explosion>().duration = explosionDuration; Instantiate(explosion, transform.position, Quaternion.identity); } if (destroyOnDeath) { Destroy(gameObject); if (deathCount) { _GM_.killCount++; } } }
// Start is called before the first frame update void Start() { pointE = GetComponent <PointEffector2D>(); anim = GetComponent <Animator>(); rigi = GetComponent <Rigidbody2D>(); StartCoroutine(countDown()); }
// Start is called before the first frame update void Start() { //Inicializamos los componentes previos y declaramos //el "point effector" desactivado, en un principio pe = GetComponent <PointEffector2D>(); pe.enabled = false; anim = GetComponent <Animator>(); }
void Start() { playerLayer = (1 << LayerMask.NameToLayer(R.S.Layer.Player)); adjustedForce = new Vector2(1, 1); player = Finder.Player; radius = GetComponent <CircleCollider2D>().radius; pointEffector2D = GetComponent <PointEffector2D>(); }
void Start() { animator = GetComponent <Animator>(); player = GameObject.FindGameObjectWithTag("Player").transform; point_effector = attack_pose.GetComponent <PointEffector2D>(); char_state.Add("hit", 1); char_state.Add("explosion", 2); }
// Start is called before the first frame update void Start() { //Accedemos al point effector y lo ponemos falso de base poi = GetComponent <PointEffector2D>(); poi.enabled = false; anim = GetComponent <Animator>(); }
// Use this for initialization void Start() { circleCollider2D = GetComponent <CircleCollider2D>(); pointEffector2D = GetComponent <PointEffector2D>(); pointEffector2D.forceMagnitude = forceMagnitude; pointEffector2D.forceVariation = forceVariation; GetComponent <AudioSource>().Play(); }
void Update() { timer -= Time.deltaTime; if (timer < 0) { PointEffector2D effector = gameObject.GetComponent <PointEffector2D>(); effector.enabled = false; } }
public RopeNode2D(Transform transform) { this.transform = transform; gameObject = transform.gameObject; rigid2D = gameObject.GetComponent <Rigidbody2D>(); boxColl2D = gameObject.GetComponent <BoxCollider2D>(); dj2D = gameObject.GetComponent <DistanceJoint2D>(); pointEffector2D = gameObject.GetComponent <PointEffector2D>(); }
public void Die() { //////////////////// Drop all items PlayerWeaponManager wm = GetComponent <PlayerWeaponManager>(); List <GameObject> weapons = wm.weapons; //////////////////// Spawn bodyparts foreach (GameObject bodyPart in corpse) { Instantiate(bodyPart, transform.position + new Vector3(Random.Range(-corpseSpawnOffset, corpseSpawnOffset), Random.Range(-corpseSpawnOffset, corpseSpawnOffset), 0.0f), Quaternion.identity); } //////////////////// Explode GameObject thisExplosion = explosion; CircleCollider2D thisCollider = thisExplosion.GetComponent <CircleCollider2D>(); PointEffector2D thisEffector = thisExplosion.GetComponent <PointEffector2D>(); thisCollider.radius = explosionRadius; thisEffector.forceMagnitude = explosionForce; thisExplosion.GetComponent <Explosion>().duration = explosionDuration; Instantiate(explosion, transform.position, Quaternion.identity); /////////////////// Self Destruct GameObject.FindGameObjectWithTag("PlayerGraphics").SetActive(false); GameObject.FindGameObjectWithTag("PlayerJetpack").SetActive(false); GetComponent <PlayerMove>().enabled = false; GetComponent <PlayerPickUp>().enabled = false; GetComponent <PlayerAnimControl>().enabled = false; GetComponent <PlayerWeaponManager>().enabled = false; GetComponent <Animator>().enabled = false; GetComponent <BoxCollider2D>().enabled = false; GetComponent <CircleCollider2D>().enabled = false; GetComponent <Rigidbody2D>().simulated = false; foreach (GameObject weapon in weapons) { weapon.SetActive(true); weapon.GetComponent <WeaponStats>().Drop(); weapon.GetComponent <WeaponStats>().is_shooting = false; weapon.GetComponent <Animator>().SetBool("Shooting", false); //Debug.Log("Weapon dropped"); } GameObject.FindGameObjectWithTag("UI").GetComponent <UI_Dead>().Dead(); //GameObject.FindGameObjectWithTag("Cursor").GetComponent<Cursory>().enabled = false; //GameObject.FindGameObjectWithTag("Cursor").GetComponent<SpriteRenderer>().enabled = false; //Cursor.visible = true; _GM_.playerAlive = false; enabled = false; }
// Use this for initialization void Start() { effector = GetComponent <PointEffector2D>(); collider = GetComponent <Collider2D>(); smoke.Play(); flash.Play(); fire.Play(); }
public void Randomize() { PointEffector2D effector = GetComponent <PointEffector2D> (); float forceMag = Random.Range(_ForceMagMin, _ForceMagMax); effector.forceMagnitude = forceMag; }
// Start is called before the first frame update void Start() { RigiEgg = GetComponent <Rigidbody2D>(); Point = GetComponent <PointEffector2D>(); Collider = GetComponent <PolygonCollider2D>(); RigiEgg.velocity = new Vector2(0, -10); Sprite = GetComponent <SpriteRenderer>(); }
void Start() { id = GetComponent <Player.Player>().id; rb2D = GetComponent <Rigidbody2D>(); gravity = GameObject.Find("Gravity").GetComponent <PointEffector2D>(); // For ladder anti-gravity // Ignore collisions between PlayerCharacters Physics2D.IgnoreLayerCollision(gameObject.layer, gameObject.layer); }
void Start() { rowballSprite = transform.GetChild(0).gameObject; bounds = GetComponent <PolygonCollider2D>(); effector = GetComponent <PointEffector2D>(); collisionBounds = transform.GetChild(1).GetComponent <PolygonCollider2D>(); //Somewhat hardcoded Build(); Update(); }
// Use this for initialization void Awake() { player = GameObject.FindWithTag("Player"); pReference = player.GetComponent <PlayerReferences>(); locationHandler = pReference.locationHandler; ourPointEffector = GetComponentInChildren <PointEffector2D>(); proximityTriggerObject = GameObject.Find("PlanetProximityHandler"); gravityWellObject = GameObject.Find("GravityWell"); // parent = transform.parent.gameObject; }
// 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; }
private void Boom() { TargetBox expl = this.gameObject.GetComponent <TargetBox>(); PointEffector2D pe2D = expl.GetComponent <PointEffector2D>(); SpriteRenderer s = expl.GetComponent <SpriteRenderer>(); pe2D.enabled = true; s.enabled = false; Instantiate(ExplosionPrefab, transform.position, Quaternion.identity, transform.parent); Invoke("Destruct", 0.1f); }
private void Boom() { PointEffector2D pe = gameObject.GetComponent <PointEffector2D>(); pe.enabled = true; SpriteRenderer sr = gameObject.GetComponent <SpriteRenderer>(); sr.enabled = false; Instantiate(ExplosionPrefab, transform.position, Quaternion.identity, transform.parent); Invoke("Destruct", 0.1f); }
// Use this for initialization void Start() { rb2d = GetComponent<Rigidbody2D>(); anim = GetComponent<Animator>(); eff = GetComponent<PointEffector2D>(); //eff = GetComponentInChildren<PointEffector2D>(); eff.enabled = false; curHealth = maxHealth; gm = GameObject.FindGameObjectWithTag("GameMaster").GetComponent<gameMaster>(); gameWonUI.SetActive(false); }