public void TriggerPortalEntry(PortalType type) { if (redPortal == null || bluePortal == null) { return; } PortalController exit; GameObject player = trans.parent.gameObject; ArrowKeyMovement playerMovement = player.GetComponent <ArrowKeyMovement>(); if (playerMovement.portalExit) { return; } if (type == PortalType.Red) { AudioSource.PlayClipAtPoint(portalEnterRed, Camera.main.transform.position, 0.35f); exit = bluePortal; } else { AudioSource.PlayClipAtPoint(portalEnterBlue, Camera.main.transform.position, 0.35f); exit = redPortal; } player.transform.position = exit.transform.position; playerMovement.portalExit = true; playerMovement.SetDirection(GameController.getReverseDirection(exit.portalDir)); }
// Start is called before the first frame update void Start() { text_component = GetComponent <Text>(); text_component.text = ""; dialogue_text[0] = dialogue_text[0].Replace("\\n", "\n"); player_control = player.GetComponent <ArrowKeyMovement>(); }
private void OnCollisionEnter(Collision collision) { GameObject collider = collision.gameObject; if (collider.name == "Tile_WALL") { OpenDoor(LockedDoorLeft.GetComponent <Animator>(), LockedDoorRight.GetComponent <Animator>()); Physics.IgnoreCollision(GetComponent <Collider>(), collider.GetComponent <Collider>()); } if (collider.name == "Player") { ArrowKeyMovement akm = collider.gameObject.GetComponent <ArrowKeyMovement>(); Inventory it = akm.GetComponent <Inventory>(); if (it.GetKeys() != 0) { //is_open = true; //animleft.SetBool("is_open", true); //is_openright = true; //animright.SetBool("is_openright", true); //is_open2 = true; //animleft2.SetBool("is_open2", true); //is_openright2 = true; //animright2.SetBool("is_openright2", true); OpenDoor(LockedDoorLeft.GetComponent <Animator>(), LockedDoorRight.GetComponent <Animator>()); Physics.IgnoreCollision(GetComponent <Collider>(), collider.GetComponent <Collider>()); it.SubtractKeys(1); AudioSource.PlayClipAtPoint(opendoor_sound_clip, Camera.main.transform.position); } } }
// Use this for initialization void Start() { animator = GetComponent <Animator>(); playerScript = GetComponent <Player> (); swordScript = GetComponent <SwordDirection>(); bowScript = GetComponent <Bow>(); movementScript = GetComponent <ArrowKeyMovement>(); }
void Awake() { current_health = 3f; full_health = 3f; health_text.text = "Health: " + current_health.ToString() + " / " + full_health.ToString(); arm = GetComponent <ArrowKeyMovement>(); }
// Start is called before the first frame update void Start() { //hp = maxHp; state = PlayerStates.Idle; movement = GetComponent <ArrowKeyMovement>(); rb = GetComponent <Rigidbody>(); inventory = GetComponent <Inventory>(); }
// private float fullHealth = 3.0f; private void Start() { ARM = GetComponent <ArrowKeyMovement>(); sr.SetActive(false); sl.SetActive(false); sd.SetActive(false); su.SetActive(false); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); animator = GetComponent <Animator>(); movement = GetComponent <ArrowKeyMovement>(); playerController = GetComponent <PlayerController>(); weaponController = GetComponent <WeaponController>(); animator.SetLayerWeight(2, 0); }
// Use this for initialization void Awake() { player = GameObject.Find("Player"); player_arm = player.GetComponent <ArrowKeyMovement>(); player_tf = player.GetComponent <Transform>(); player_wc = player.GetComponent <WeaponControl>(); sr = GetComponent <SpriteRenderer>(); rb = GetComponent <Rigidbody>(); start_time = Time.time; }
private void Awake() { animScript = GetComponent <Animator>(); directionFacingNESW = startingDirectionNESW; swordCollider.enabled = false; swordCollider.transform.localPosition = new Vector3(.025f, -0.5f, 0); swordCollider.transform.localScale = new Vector3(.25f, .69f, 1); swordHitEnemy = false; movementScript = GetComponent <ArrowKeyMovement> (); }
private void Awake() { weapon_using = false; weapon_holding = false; weapon1 = weapons[0]; weapon2 = weapons[3]; arm = GetComponent <ArrowKeyMovement>(); tf = GetComponent <Transform>(); inventory = GetComponent <Inventory>(); has_bow = false; has_boomerang = false; counter = 3; }
void Start() { // Try to grab a reference to the inventory component on this gameobject inventory = GetComponent <Inventory>(); if (inventory == null) { Debug.LogWarning("WARNING: Gameobject with a collector has no inventory to store things in!"); } sr = GetComponent <SpriteRenderer>(); rb = GetComponent <Rigidbody> (); movement = this.GetComponent <ArrowKeyMovement>(); main_camera = Camera.main; }
// Start is called before the first frame update void Start() { obtainBWeapon = new bool[4] { true, true, true, true }; weaponSpecies = WeaponSpecies.Boomerang; animator = GetComponent <Animator>(); movement = GetComponent <ArrowKeyMovement>(); animatorInput = GetComponent <InputToAnimator>(); playerController = GetComponent <PlayerController>(); inventory = GetComponent <Inventory>(); }
private void dropMoneyAfterhurt() { ArrowKeyMovement arr = GetComponent <ArrowKeyMovement>(); int pre_num_of_res = Inventory.instance.numOfPlayerResource[arr.playerIndex]; Inventory.instance.numOfPlayerResource[arr.playerIndex] = 0; int num_of_money_dropped = pre_num_of_res - Inventory.instance.numOfPlayerResource[arr.playerIndex]; for (int i = 0; i < num_of_money_dropped; ++i) { GameObject coin = Instantiate(rupee, transform.position, Quaternion.identity); coin.transform.GetChild(0).GetComponent <RupeeInitialization>().enabled = false; coin.transform.GetComponentInChildren <Rigidbody>().velocity = new Vector3(Random.Range(-5.0f, 5.0f), 15, Random.Range(-5.0f, 5.0f));; } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { player = other.gameObject; ArrowKeyMovement akm = player.GetComponent <ArrowKeyMovement>(); input = other.GetComponent <ArrowKeyMovement>().GetInput(); player.SetActive(false); // target camera position source_camera_position = main_camera.transform.position; target_camera_position = source_camera_position; target_camera_position.x = source_camera_position.x + 16f * input.x; target_camera_position.y = source_camera_position.y + 11f * input.y; startTime = Time.time; journeyLength = Vector3.Distance(source_camera_position, target_camera_position); isLerp = true; } }
private void OnCollisionStay(Collision collision) { if (collision.gameObject.CompareTag("Player")) { GameObject player = collision.gameObject; playerStatus player_ps = player.GetComponent <playerStatus>(); ArrowKeyMovement player_am = player.GetComponent <ArrowKeyMovement>(); if (player_ps.teamIdx == ps.teamIdx && player_ps.currStatus == playerStatus.status.DEFENSE && ps.currStatus == playerStatus.status.NORMAL) { ps.currStatus = playerStatus.status.HOLDING; player_am.defenseToHeld(); } } if (collision.gameObject.CompareTag("airwall")) { if (ps.currStatus == playerStatus.status.DASH) { am.stopDash = true; } } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("cuboid")) { Destroy(collision.gameObject); inventory.addRupee(am.playerIndex); Camera.main.GetComponent <AudioSource>().PlayOneShot(collectClip, 0.5f); } if (collision.gameObject.CompareTag("airwall")) { if (ps.currStatus == playerStatus.status.DASH) { am.stopDash = true; } if (ps.currStatus == playerStatus.status.FLYING) { ReflectProjectile(collision.contacts[0].normal); } } if (collision.gameObject.CompareTag("Player")) { GameObject player = collision.gameObject; playerStatus player_ps = player.GetComponent <playerStatus>(); ArrowKeyMovement player_am = player.GetComponent <ArrowKeyMovement>(); // I am a bullet if (ps.currStatus == playerStatus.status.FLYING) { // same team if (player_ps.teamIdx == ps.teamIdx) { ReflectProjectile(collision.contacts[0].normal); } else { // different team if (player_ps.currStatus == playerStatus.status.FLYING || player_ps.currStatus == playerStatus.status.DEFENSE) { // hit another bullet //player_ps.GetComponent<Rigidbody>().isKinematic = true; ReflectProjectile(collision.contacts[0].normal); //player_ps.GetComponent<Rigidbody>().isKinematic = false; } else { am.hitEnemy = true; if (player_am == null) { player.GetComponent <ArrowKeyMovementDummy>().hurt(am.flyingDir); } else { if (Inventory.instance.numOfPlayerResource[player_am.playerIndex] >= 3 || ((player_ps.currStatus == playerStatus.status.HELD || player_ps.currStatus == playerStatus.status.HOLDING) && Inventory.instance.numOfPlayerResource[player_am.teamMember.GetComponent <ArrowKeyMovement>().playerIndex] >= 3)) { Camera.main.GetComponent <TimeManager>().DoSlowMotion(collision.contacts[0].point); Camera.main.GetComponent <CameraShake>().ShakeCameraOnHurt(0.5f, 0.15f); //ScreenShakeManager.Bump(0.15f); } else { Camera.main.GetComponent <CameraShake>().ShakeCamera(0.5f, 0.5f); //ScreenShakeManager.Bump(0.5f); } if (player.layer == 11) { return; } player.layer = 11; player_am.hurt(collision); player_am.Vibration(0.5f); am.Vibration(0.5f); } } } } else if (ps.currStatus == playerStatus.status.DASH) { // Dash will knock back enemy if (player_ps.teamIdx != ps.teamIdx && player.GetComponent <ArrowKeyMovement>() != null) { if (player_ps.currStatus == playerStatus.status.DEFENSE || player_ps.currStatus == playerStatus.status.FLYING || player_ps.currStatus == playerStatus.status.DASH) { // do nothing am.stopDash = true; } else { if (player.layer == 11) { return; } player.layer = 11; am.stopDash = true; player_am.Vibration(0.2f); am.Vibration(0.2f); StartCoroutine(player.GetComponent <ArrowKeyMovement>().knockBack(collision, player_ps.currStatus, 1.5f)); } } } else if (player_ps.teamIdx == ps.teamIdx && player_ps.currStatus == playerStatus.status.DEFENSE && ps.currStatus == playerStatus.status.NORMAL) { Debug.Log("Holding"); ps.currStatus = playerStatus.status.HOLDING; player_am.defenseToHeld(); } } }
void Start() { ps = GetComponent <playerStatus>(); am = GetComponent <ArrowKeyMovement>(); inventory = GameObject.Find("Inventory").GetComponent <Inventory>(); }
// Start is called before the first frame update void Start() { rm = Camera.main.GetComponent <RoomTransition>(); player_control = GetComponent <ArrowKeyMovement>(); }
// Start is called before the first frame update void Start() { arr = GetComponent <ArrowKeyMovement>(); SoundPlayer2D = GetComponent <AudioSource>(); }
// Start is called before the first frame update void Start() { rend = GetComponent <SpriteRenderer>(); am = transform.parent.gameObject.GetComponent <ArrowKeyMovement>().teamMember.GetComponent <ArrowKeyMovement>(); originalMaterial = rend.material; }
void Start() { am = parent.GetComponent <ArrowKeyMovement>(); }
void Start() { animator = GetComponent <Animator>(); movement = transform.parent.gameObject.GetComponent <ArrowKeyMovement>(); }
private void Awake() { arm = player.GetComponent <ArrowKeyMovement>(); }