private void OnTriggerEnter2D(Collider2D collision) { //explode if a player comes within range if (collision.gameObject.CompareTag("Player") && !exploded) { exploded = true; RpcSendExploded(exploded); print("sending exploded status to server"); startTime = Time.time; //knocks back all rigidbodies and applies a 0.5 second stun to players within the blast radius of 20 units Collider2D[] inRange = Physics2D.OverlapCircleAll(transform.position, 20); foreach (Collider2D cd in inRange) { GameObject other = cd.gameObject; Rigidbody2D rb = other.GetComponent <Rigidbody2D>(); if (rb != null) { Vector2 direction = (other.transform.position - transform.position).normalized; rb.AddForce(new Vector2(direction.x, direction.y + 0.2f) * blastForce); Platformer2DUserControl robot = other.GetComponent <Platformer2DUserControl>(); if (robot != null) { robot.applyStun(0.5f); } ; } } } }
private void Start() { player = GameObject.FindGameObjectWithTag("Player"); userControls = player.GetComponent <Platformer2DUserControl>(); animator = GetComponent <Animator>(); }
// Start is called before the first frame update void Start() { gameOver = FindObjectOfType(typeof(Text)) as Text; robot = FindObjectOfType(typeof(Platformer2DUserControl)) as Platformer2DUserControl; gameOver.text = "GameOver"; gameOver.gameObject.SetActive(false); }
private void Awake() { player_Transform = GameObject.FindWithTag("Player").GetComponent <Transform>(); script_Platformer2DUserControl = GameObject.Find("Player").GetComponent <Platformer2DUserControl>(); anin_imgPreta = GameObject.Find("Imagem Preta").GetComponent <Animator>(); boxC = GetComponent <BoxCollider2D>(); }
private void Awake() { Player = GameObject.Find("Player").GetComponent <Transform>(); script_Platformer2DUserControl = Player.GetComponent <Platformer2DUserControl>(); script_Audio_MainScript = GameObject.Find("Main Camera").GetComponent <Audio_MainScript>(); platformer2DCharacter_Script = GameObject.FindGameObjectWithTag("Player").GetComponent <PlatformerCharacter2D>(); }
// Use this for initialization void Awake() { scrip_Audio_MainScript = GameObject.Find("Main Camera").GetComponent <Audio_MainScript>(); thisCanvas = GetComponentInParent <Canvas>(); mainCamera = GameObject.Find("Main Camera").GetComponent <Camera>(); script_Platformer2DUserControl = GameObject.Find("Player").GetComponent <Platformer2DUserControl>(); }
// Use this for initialization void Start() { particleSys = GetComponent <ParticleSystem>(); playerMovement = GetComponent <PlatformerCharacter2D>(); user = GetComponent <Platformer2DUserControl>(); powerUpIntialized = false; }
void Awake() { playerController = gameObject.transform.parent.GetComponent <Platformer2DUserControl>(); playerCharacterScript = gameObject.transform.parent.GetComponent <PlatformerCharacter2D>(); lr = GetComponent <LineRenderer>(); g = Mathf.Abs(Physics2D.gravity.y); }
public void EndGame() { lb.UpdateLeaderBoard((int)s.Getscore()); Platformer2DUserControl puc = transform.GetComponent <Platformer2DUserControl>(); PlatformerCharacter2D pc = transform.GetComponent <PlatformerCharacter2D>(); foreach (GameObject a in sp) { SpawnerScript ss = a.GetComponent <SpawnerScript>(); ss.Stopinvokation(); a.SetActive(false); } PlatformSpawner p = plat_s.GetComponent <PlatformSpawner>(); p.Stopinvokation(); plat_s.SetActive(false); SpawnerScript1 ss1 = sp1.GetComponent <SpawnerScript1>(); ss1.Stopinvokation(); sp1.SetActive(false); puc.enabled = false; pc.enabled = false; s.Setincrement(0); if (robot_explosion) { var explosion = Instantiate(robot_explosion, transform.position, transform.rotation); Destroy(explosion, 1.0f); } anim.SetBool("Destroy", true); Scorecard.SetActive(true); Scorecard.GetComponent <Scorecard> ().SetScore((int)s.Getscore()); }
void OnEnable() { actions = new List<CutsceneAction>(); for (int i = 0; i < transform.childCount; i++) { Transform t = transform.GetChild(i); CutsceneAction act = t.GetComponent<CutsceneAction>(); if (act != null) actions.Add(act); } if (actions.Count == 0) return; if (LockPlayer) { playerControl = GameObject.Find("PlayerCharacter").GetComponent<Platformer2DUserControl>(); playerControl.enabled = false; } foreach (var action in actions) { action.parentCutscene = this; action.gameObject.SetActive(false); } actions[0].gameObject.SetActive(true); actions[0].OnActionInit(); }
private void Awake() { script_Audio_MainScript = GameObject.Find("Main Camera").GetComponent <Audio_MainScript>(); player = GameObject.Find("Player").GetComponent <Transform>(); boxC = GetComponent <BoxCollider2D>(); script_Platformer2DUserControl = GameObject.Find("Player").GetComponent <Platformer2DUserControl>(); player_canvas = GameObject.Find("CanvasPlayerDialogo").GetComponent <Canvas>(); if (gameObject.name != "_NPCs_(SALADEAULA)_1") { if (gameObject.name != "_NPCs_(SALADEAULA)_2") { if (gameObject.name != "_NPCs_(SALADEAULA)_3") { //img_efeito_minigame = GameObject.Find("img_efeitoMiniGame").GetComponent<Image>(); } } } script_pensamentoController = GameObject.Find("PensamentoController").GetComponent <PensamentoController>(); //Alterações Danilo if (SceneManager.GetActiveScene().name == "Dia_1") { if (GameObject.Find("Teleporte(sala<->escola)") != null) { script_Teleporte = GameObject.Find("Teleporte(sala<->escola)").GetComponent <Teleporte>(); } } //CacaPalavras = GameObject.Find("_Caça-Palavras"); //CacaPalavras2 = GameObject.Find("_Caça-Palavras2"); }
private void explode() { //this bomb explodes into 8 fragments, which fly in all directions for (float i = 0; i < 360; i += 360f / 8f) { GameObject newfragment = Instantiate(fragment, new Vector2(transform.position.x + 2 * Mathf.Sin((i * Mathf.PI) / 180f), transform.position.y + 2 * Mathf.Cos((i * Mathf.PI) / 180f)), Quaternion.identity); newfragment.GetComponent <Rigidbody2D>().velocity = new Vector2(50 * Mathf.Sin((i * Mathf.PI) / 180f), 50 * Mathf.Cos((i * Mathf.PI) / 180f)); NetworkServer.Spawn(newfragment); } //interrupts movement of players within 5 units radius and applies a 0.4 second stun to them Collider2D[] inRange = Physics2D.OverlapCircleAll(transform.position, 5); foreach (Collider2D cd in inRange) { GameObject other = cd.gameObject; Platformer2DUserControl robot = other.GetComponent <Platformer2DUserControl>(); if (robot != null) { robot.applyStun(0.4f); other.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0); } } NetworkServer.Destroy(gameObject); Destroy(gameObject); }
private void Awake() { scriptDIAProgress_Controller = GameObject.Find("Player").GetComponent <DIAProgress_Controller>(); scriptPlatformer2DUserControl = GameObject.Find("Player").GetComponent <Platformer2DUserControl>(); scriptAudio_MainScript = GameObject.Find("Main Camera").GetComponent <Audio_MainScript>(); textNOAHApresentacao.gameObject.SetActive(false); }
void OnEnable() { actions = new List <CutsceneAction>(); for (int i = 0; i < transform.childCount; i++) { Transform t = transform.GetChild(i); CutsceneAction act = t.GetComponent <CutsceneAction>(); if (act != null) { actions.Add(act); } } if (actions.Count == 0) { return; } if (LockPlayer) { playerControl = GameObject.Find("PlayerCharacter").GetComponent <Platformer2DUserControl>(); playerControl.enabled = false; } foreach (var action in actions) { action.parentCutscene = this; action.gameObject.SetActive(false); } actions[0].gameObject.SetActive(true); actions[0].OnActionInit(); }
// Use this for initialization void Start() { GameObject player = GameObject.FindGameObjectWithTag("Player"); playerControl = player.GetComponent <Platformer2DUserControl> (); anim = player.GetComponent <Animator> (); }
// Use this for initialization void Start() { player = FindObjectOfType<Platformer2DUserControl>(); if (player == null) Debug.Log ("No player found"); }
private void Awake() { canvasPlayer.enabled = false; canvasPlayerDialogueIT.enabled = false; canvasPlayerPergunta.enabled = false; scriptPlayer = GameObject.Find("Player").GetComponent <Platformer2DUserControl>(); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.transform.CompareTag("Player")) { player = collision.gameObject.GetComponent <Platformer2DUserControl>(); //gameObject.layer = 14; } }
void Start() { audio = GetComponent <AudioSource>(); puc = GetComponent <Platformer2DUserControl>(); gun = GetComponentInChildren <Gun>(); sr = GetComponent <SpriteRenderer>(); anim = GetComponent <Animator>(); }
void Awake() { // Setting up references. groundCheck = transform.Find("GroundCheck"); ceilingCheck = transform.Find("CeilingCheck"); anim = GetComponent <Animator>(); userControl = GetComponent <Platformer2DUserControl>(); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Player")) { Platformer2DUserControl player = collision.gameObject.GetComponent <Platformer2DUserControl>(); player.Die(false); } }
void OnCollisionEnter2D(Collision2D other) { if ((other.collider.CompareTag("Player") == true) && (Platformer2DUserControl.CurrentMode == Platformer2DUserControl.Mode.Playing)) { Platformer2DUserControl.StartRespawn(); RotateEverything.RotateTo(Platformer2DUserControl.RespawnCheckPoint); } }
private void Awake() { userControl = GetComponent <Platformer2DUserControl>(); platformerCharacter2D = GetComponent <PlatformerCharacter2D>(); gravity = GetComponent <Gravity>(); platformerCharacter2D.OnCharacterJump += Jump; animator = GetComponent <Animator>(); SetAsActivePlayer(false); }
void OnTriggerExit2D(Collider2D other) { if ((Platformer2DUserControl.CurrentMode == Platformer2DUserControl.Mode.Playing) && (isOutOfBounds == false) && (other.CompareTag("Player") == true)) { Platformer2DUserControl.StartRespawn(respawnComplete: Reset); RotateEverything.RotateTo(Platformer2DUserControl.RespawnCheckPoint); isOutOfBounds = true; } }
void Awake() { // Setup variables instance = this; // Get components character = GetComponent <PlatformerCharacter2D>(); playerBody = GetComponent <Rigidbody2D>(); }
void EnQueuePool() { Platformer2DUserControl platformer2DUserControl = PPLSPOOL.Dequeue(); platformer2DUserControl.gameObject.SetActive(true); platformer2DUserControl.transform.SetParent(null); platformer2DUserControl.transform.position = ValueSheet.PPLSpawnPos; }
void Start() { playerCharacter = GameObject.FindObjectOfType <Platformer2DUserControl>(); lives = GameObject.FindObjectOfType <PlayerLives>(); playerName = GetComponentInChildren <PlayerName>(); textCounter = GetComponentInChildren <LivesTextCounter>(); cooldown = 5f; this.transform.SetParent(null); }
public IEnumerator disableMovementsForPeriod(float disableDuration, Collider2D pep) { Platformer2DUserControl pepController = pep.GetComponent <Platformer2DUserControl> (); pepController.disableMovement(); yield return(new WaitForSeconds(disableDuration)); pepController.enableMovement(); yield return(null); }
// Use this for initialization void Awake() { m_Player = this.transform.parent.GetComponent <PlatformerCharacter2D>(); m_PlayerController = this.transform.parent.GetComponent <Platformer2DUserControl>(); firePoint = transform.Find("FirePoint"); if (firePoint == null) { Debug.LogError("No FirePoint found"); } }
// public NPC1_MainScript scriptMoleke_01; // public NPC1_MainScript scriptMoleke_03; private void Awake() { scriptGameController = GameObject.Find("GameController").GetComponent <GameController>(); scriptPlatformer2DUserControl = GameObject.Find("Player").GetComponent <Platformer2DUserControl>(); scriptSystemDialogueMental = GameObject.Find("Player").GetComponent <SystemDialogueMental>(); scriptSystemDialoguePlayer = GameObject.Find("Player").GetComponent <Baloes_Controller>(); scriptCanvas_MainScript = GameObject.Find("_MainCanvas").GetComponent <Canvas_MainScript>(); // scriptNPC1_MainScript = GameObject.Find("_Robozinho").GetComponent<NPC1_MainScript>(); scriptAudio_MainScript = GameObject.Find("Main Camera").GetComponent <Audio_MainScript>(); }
private void OnCollisionEnter2D(Collision2D collision) { //when a player touches the black hole, //apply stasis to the player with duration equal to the remaining duration of the black hole. Platformer2DUserControl robot = collision.gameObject.GetComponent <Platformer2DUserControl>(); if (robot != null) { robot.applyStasis(duration - (Time.time - startTime)); } }
bool damaged; // True when the player gets damaged. void Awake() { // Setting up the references. anim = GetComponent <Animator>(); playerAudio = GetComponent <AudioSource>(); playerMovement = GetComponent <Platformer2DUserControl>(); //playerShooting = GetComponentInChildren<PlayerShooting>(); // Set the initial health of the player. currentHealth = startingHealth; }
// Use this for initialization void Start() { player = FindObjectOfType<Platformer2DUserControl>(); // need to change...again....(i think platformer2dusercontrol) if (textfile != null) { textLines = (textfile.text.Split('\n')); } if (endAtLine == 0) { endAtLine = textLines.Length - 1; } if(isActive) { EnableTextBox(); } else { DisableTextBox(); } }
// Use this for initialization void Start () { CharacterRobotBoy = FindObjectOfType<Platformer2DUserControl>(); }
// Use this for initialization void Start() { p2ducScript = GetComponent<Platformer2DUserControl>(); }
void Start() { player = GameObject.Find ("Player"); targetPosition = otherPortal.transform.position; playerMovement = player.GetComponent<Platformer2DUserControl>(); }