//TODO: uncomment and fix behavior for animation //public Animator animator; void Start() { this.CurrentPhase = Phase.None; this.DistanceToGround = this.GetComponent <BoxCollider2D>().bounds.extents.y; this.Width = this.GetComponent <BoxCollider2D>().bounds.extents.x; _GrapplingHook = this.GetComponent <GrapplingHook>(); }
public void init() { pos = Map.grid.grid_to_world(Map.grid.world_to_grid(transform.position)); current_node = Map.grid.get_node(Map.grid.world_to_grid(pos)); controller = GetComponent <PlatformCollision>(); controller.init(); player_movement = GetComponent <PlayerMovement>(); player_movement.init(); Transform weapon_obj = transform.parent.FindChild("weapon"); if (weapon_obj == null) { Debug.LogError("'weapon' object cannot be found in player parent's children"); } weapon_inventory = weapon_obj.GetComponent <WeaponInventory>(); weapon_inventory.init(this); weapon_control = weapon_obj.GetComponent <PlayerWeaponControl>(); weapon_control.init(); grappling_hook = GetComponent <GrapplingHook>(); grappling_hook.init(); health = GetComponent <GenericHealth>(); health.init(this); }
public void OnSceneGUI() { if (myTarget == null) { myTarget = (GrapplingHook)target; oldTimeToChange = myTarget.timeToChangeLength; oldSpeed = myTarget.changeSpeed; } Color c = Color.green; c.a = 0.1f; Handles.color = c; Handles.DrawSolidDisc(((GrapplingHook)target).transform.position, Vector3.forward, ((GrapplingHook)target).range); if (oldTimeToChange != myTarget.timeToChangeLength) { float oldChangeSpeed = myTarget.changeSpeed; myTarget.changeSpeed *= (myTarget.timeToChangeLength / oldTimeToChange); if (float.IsNaN(myTarget.changeSpeed)) { myTarget.changeSpeed = oldChangeSpeed; } } if (oldSpeed != myTarget.changeSpeed && myTarget.changeSpeed < 0) { myTarget.changeSpeed = oldSpeed; } if (oldTimeToChange != myTarget.timeToChangeLength && myTarget.timeToChangeLength < 0) { myTarget.timeToChangeLength = oldTimeToChange; } oldSpeed = myTarget.changeSpeed; oldTimeToChange = myTarget.timeToChangeLength; }
public static void Postfix(GrapplingHook __instance, Collision collisionInfo) { var target = __instance.GetTargetRigidbody(collisionInfo.gameObject); if (target == null) { return; } var creature = target.GetComponent <Creature>(); if (creature == null) { return; } var mixin = creature.GetComponent <LiveMixin>(); if (mixin == null) { return; } if (QMultiModSettings.Instance.ExosuitGrapplingArmDamage != 0f) // to avoid potential event triggers { mixin.TakeDamage(QMultiModSettings.Instance.ExosuitGrapplingArmDamage, creature.transform.position, DamageType.Normal, null); } }
/// <summary> /// initializes all parameters prior to a dash and triggers the pre dash feedbacks /// </summary> public virtual void InitiateGrapple() { // we start our sounds PlayAbilityStartSfx(); PlayAbilityUsedSfx(); // we initialize our various counters and checks CooldownTimeStamp = Time.time + grappleCooldown; ComputeGrappleDirection(); CheckFlipCharacter(); RaycastHit2D hit = MMDebug.RayCast(transform.position, GrappleDirection, grappleDistance, _controller.PlatformMask, Color.blue, true); if (hit.collider == null) { return; } GameObject go = Instantiate(grapplePrefab, hit.point, new Quaternion(), hit.transform.parent); GrapplingHook hook = go.GetComponent <GrapplingHook>(); hook.hasGrip = hasGrip; hook.source = gameObject; hook.DeployHook(); // we play our exit sound StopAbilityUsedSfx(); PlayAbilityStopSfx(); }
void Start() { flashlight = GetComponentInChildren <FlashlightToggle>(); explain = GetComponentInChildren <ExplainItems>(); grapplingHook = GetComponent <GrapplingHook>(); fpc = GetComponent <FirstPersonController>(); grapplingHook.enabled = false; Unlocks.OnGrapplingHookChanged.AddListener(() => { UpdateGrapplingHook(); }); Unlocks.OnDoubleJumpChanged.AddListener(() => { UpdateDoubleJump(); }); Unlocks.OnFlashlightChanged.AddListener(() => { UpdateFlashlight(); }); UpdateDoubleJump(); UpdateGrapplingHook(); UpdateFlashlight(); }
void Start() { // PrevRotation = this.gameObject.transform.rotation; this.CurrentPhase = Phase.None; this.DistanceToGround = this.GetComponent <BoxCollider2D>().bounds.extents.y; _GrapplingHook = this.GetComponent <GrapplingHook>(); }
void MovementSound() { //KostinKoodi RaycastHit movementRayHit; if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.down), out movementRayHit, transform.lossyScale.y + 0.5f, LayerMask.GetMask("Geometry"))) { Color32 bloodColor = new Color32(138, 3, 3, 50); //Debug.Log("Asd" + GetPixelColor(movementRayHit)); if (GetPixelColor(movementRayHit).ColorEq(bloodColor)) { walkingOnBlood = true; } else { walkingOnBlood = false; } } GrapplingHook grapplingHook = transform.Find("Main Camera").GetComponent <GrapplingHook>(); if (movingWithInput == true && dodging == false && grounded == true && !grapplingHook.newGrapplingHook) { FMODUnity.RuntimeManager.PlayOneShotAttached("event:/SX/Player/Small/Player_small_movement", gameObject); if (walkingOnBlood) { FMODUnity.RuntimeManager.PlayOneShotAttached("event:/SX/Blood/Sx_blood_footsteps", gameObject); } } }
// Start is called before the first frame update void Start() { move = GetComponent <PlayerMove>(); jump = GetComponent <PlayerJump>(); climb = GetComponent <PlayerClimb>(); playerMask = GetComponent <Masks>(); playerItem = GetComponent <Item>(); maskController = FindObjectOfType <MaskController>(); inventory = FindObjectOfType <Inventory>(); speech = FindObjectOfType <SpeechScript>(); anim = GetComponent <Animator>(); grapple = FindObjectOfType <GrapplingHook>(); hasJumped = false; hasWallJumped = false; isClimbing = false; isZipping = false; moving = true; launched = false; hasRune = false; GetComponent <DistanceJoint2D>().enabled = false; maskInventory = new List <string>(); itemInventory = new List <string>(); maskCounter = 0; itemCounter = 0; knockbackCount = knockbackLength; }
// Start is called before the first frame update void Awake() { #region Singelton check if (Instance != null) { Destroy(gameObject); } else { Instance = this; } #endregion DontDestroyOnLoad(gameObject); throwScript = GetComponent <Throw>(); move = GetComponent <PlayerMovement>(); animeScript = GetComponent <PlayerAnimationScript>(); summon = GetComponent <Summon>(); grapplingHook = GetComponent <GrapplingHook>(); coll = GetComponent <Collision>(); pickUp = GetComponent <PickUp>(); SetCameraToFollowPlayer(); maxHealth = health; scripts.Add(throwScript); scripts.Add(summon); scripts.Add(grapplingHook); }
// Use this for initialization void Start() { activeObject = false; playerState = 1; maxHealth = 5; thiefHealth = maxHealth; wizardHealth = maxHealth; knightHealth = 8; knightAlive = true; thiefAlive = true; wizardAlive = true; deathConfirmed = false; spawnSmoke = false; wizardChild = gameObject.transform.GetChild(0).GetChild(0).gameObject; thiefChild = gameObject.transform.GetChild(1).GetChild(0).gameObject; knightChild = gameObject.transform.GetChild(2).GetChild(0).gameObject; grapple = GetComponent <GrapplingHook>(); bow = GetComponent <Bow>(); mouseFunctionsSummonableCube = summonableCube.GetComponent <MouseFunctions>(); playerRigidbody = gameObject.GetComponent <Rigidbody>(); knightFunctions = gameObject.GetComponent <KnightFunctions>(); particleCube = summonableCube.GetComponent <ParticleSystem>(); playerMovement = gameObject.GetComponent <PlayerMovement>(); thiefSpeed = 10; knightSpeed = 10; wizardSpeed = 10; }
private void Start() { Camera.main.gameObject.GetComponent <CameraBehavior>().target = this.transform.parent.Find("Waist").transform; targetMouse = GetComponent <TargetMouse>(); gHook = GetComponent <GrapplingHook>(); rLauncher = GetComponent <RocketLauncher>(); }
void Start() { hook = GetComponentInChildren <GrapplingHook>(); animator = GetComponent <Animator>(); spawnEffect = gameObject.GetComponentInChildren <SpawnEffect>(); //doubleJumpParticle = GameObject.Find ("doubleJump").GetComponent<DoubleJumpParticle> (); spawn = transform.position; }
void Start() { ropeObject = GameObject.Find("Rope"); rope = ropeObject.GetComponent <LineRenderer>(); // rope.SetWidth(0.3f, 0.3f); // rope.enabled = false; grapplingHook = gameObject.GetComponent <GrapplingHook>(); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); grapplingHook = GetComponent <GrapplingHook>(); playerCon = GetComponentInParent <PlayerController>(); playerNum = playerCon.playerNum; moveDir = playerCon.moveDir; }
private void InitHookObject(PlayerPickupsModule pPickupsModule) { GrapplingHook pHook = Instantiate(m_pHookPrefab); pPickupsModule.m_pMaster.m_pInventorySlotsModule.EquipItemInSlot(pHook.transform, EInventorySlot.BELT, false); pPickupsModule.SetVariable(c_sVariableName_pGrapplingHookObject, pHook); }
// Start is called before the first frame update void Start() { player = FindObjectOfType <PlayerInput>(); health = FindObjectOfType <HealthManager>(); grapple = FindObjectOfType <GrapplingHook>(); playerMove = FindObjectOfType <PlayerMove>(); herbs = 0; }
void Start() { hook = GetComponentInChildren<GrapplingHook>(); animator = GetComponent<Animator>(); spawnEffect = gameObject.GetComponentInChildren<SpawnEffect>(); //doubleJumpParticle = GameObject.Find ("doubleJump").GetComponent<DoubleJumpParticle> (); spawn = transform.position; }
// Start is called before the first frame update void Start() { playerMove = FindObjectOfType <PlayerMove>(); player = FindObjectOfType <PlayerInput>(); inventory = FindObjectOfType <Inventory>(); loader = FindObjectOfType <LevelLoader>(); grappling = FindObjectOfType <GrapplingHook>(); }
// Update is called once per frame void Update() { var vertical = Input.GetAxisRaw("Vertical"); var horizontal = Input.GetAxisRaw("Horizontal"); // Cannot go Up if not in the water if (!m_entity.InWater()) { vertical = Mathf.Clamp(vertical, -1.0f, 0f); } //Debug.Log("Vertical " + vertical); m_entity.SetMoveDirection(new Vector3(horizontal, vertical, 0), true); // Grappling hook if (Input.GetKeyDown(KeyCode.Mouse1) && PlayerLevel >= 1) { Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); Vector3 dir3 = mousePosition - transform.position; Vector2 dir = new Vector2(dir3.x, dir3.y).normalized; foreach (Transform child in grapplingHookParent) { Destroy(child.gameObject); } GameObject hook = Instantiate(grapplingHook, transform.position + (Vector3)dir * 0.3f, Quaternion.identity, grapplingHookParent); m_lastHook = hook.GetComponent <GrapplingHook>(); m_lastHook.SetMoveDirection(dir); if (PlayerLevel == 1) { m_lastHook.SetHookSpeed(level1HookSpeed); } else if (PlayerLevel >= 2) { m_lastHook.SetHookSpeed(level2HookSpeed); } } // If a movement key is pressed, delete latched hook if ( Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.DownArrow) ) { if (m_lastHook != null) { m_lastHook.DeleteIfLatched(); } } }
// Use this for initialization void Start() { Time.timeScale = 1; isPaused = false; player = GameObject.Find("KodamaPlayer").GetComponent <Transform>(); grapplingHook = GameObject.Find("Grappling Hook").GetComponent <Transform>(); playerScript = GameObject.Find("KodamaPlayer").GetComponent <Player>(); grappleScript = GameObject.Find("Grappling Hook").GetComponent <GrapplingHook>(); }
void OnTriggerEnter(Collider other) { if (other.tag == "Hookable") { GrapplingHook hook = player.GetComponent <GrapplingHook>(); hook.hooked = true; hook.hookedObject = other.gameObject; } }
// Use this for initialization void Start() { Time.timeScale = 1; isPaused = false; player = GameObject.Find("KodamaPlayer").GetComponent<Transform>(); grapplingHook = GameObject.Find("Grappling Hook").GetComponent<Transform>(); playerScript = GameObject.Find("KodamaPlayer").GetComponent<Player>(); grappleScript = GameObject.Find("Grappling Hook").GetComponent<GrapplingHook>(); }
private void PutHookBackInBelt(GrapplingHook pHook, PlayerCharacter pPlayer) { pHook.m_pRopeEnd.SetParent(pHook.m_pRopeObject.transform); pHook.m_pRopeEnd.localPosition = Vector3.zero; pHook.m_pRopeObject.SetActive(false); pPlayer.m_pInventorySlotsModule.EquipItemInSlot(pHook.transform, EInventorySlot.BELT, false); pHook.transform.localPosition = m_pHookPrefab.transform.localPosition; pHook.transform.localRotation = m_pHookPrefab.transform.localRotation; }
public override void LandHit(RaycastHit hit, Vector3 hitPosition) { base.LandHit(hit, hitPosition); grapplingHook = GetOwningGun().GetComponent <GrapplingHook>(); if ((grapplingHook != null) && (hit.transform != null)) { grapplingHook.RegisterHit(hit.transform.gameObject, hitPosition); } }
private void OnCollisionEnter(Collision collisionInfo) { SeaMoth componentInParent = collisionInfo.gameObject.GetComponentInParent <SeaMoth>(); GrapplingHook component = collisionInfo.gameObject.GetComponent <GrapplingHook>(); if (staticAttached || (fixedJoint && fixedJoint.connectedBody) || componentInParent != null || component != null) { return; } Rigidbody targetRigidbody = GetTargetRigidbody(collisionInfo.gameObject); rb.velocity = Vector3.zero; if (targetRigidbody != null && JointHelper.ConnectFixed(gameObject, targetRigidbody)) { staticAttached = false; } else { staticAttached = true; rb.isKinematic = true; } Utils.PlayFMODAsset(hitSound, transform, 5f); Vector3 vector = default(Vector3); int num = 0; for (int i = 0; i < collisionInfo.contacts.Length; i++) { ContactPoint contactPoint = collisionInfo.contacts[i]; if (num == 0) { vector = contactPoint.normal; } else { vector += contactPoint.normal; } num++; } if (num > 0) { vector /= num; Vector3 eulerAngles = Quaternion.LookRotation(transform.forward, vector).eulerAngles; eulerAngles.z -= 90f; transform.eulerAngles = eulerAngles; } VFXSurface component2 = collisionInfo.gameObject.GetComponent <VFXSurface>(); VFXSurfaceTypeManager.main.Play(component2, VFXEventTypes.impact, transform.position, transform.rotation, null); }
private void InitAnticipation(PlayerPickupsModule pPickupsModule) { pPickupsModule.SetVariable(c_sVariableName_fGrapplingHookCurrentStepStartTime, Time.time); pPickupsModule.m_pMaster.SetBehaviourFrozen(true); GrapplingHook pHook = (GrapplingHook)(pPickupsModule.GetVariable(c_sVariableName_pGrapplingHookObject)); pPickupsModule.m_pMaster.m_pInventorySlotsModule.EquipItemInSlot(pHook.transform, EInventorySlot.HAND, false); pPickupsModule.SetVariable(c_sVariableName_eGrapplingHookCurrentStep, EGrapplingHookEffectStep.ANTICIPATION); }
void Awake() { m_animator = GetComponent <Animator>(); if (m_animator == null) { Debug.Log("Animator could not be found"); } ground_animator = m_animator.runtimeAnimatorController; m_rigidbody = GetComponent <Rigidbody>(); if (m_rigidbody == null) { Debug.Log("Rigid body could not be found"); } playerAudio = GetComponent <AudioSource>(); m_collider = GetComponent <Collider>(); if (m_collider == null) { Debug.Log("Collider could not be found for player object."); } Sword = GameObject.FindGameObjectsWithTag("Sword"); if (Sword.Length == 0) { Debug.LogWarning("No sword"); } else { foreach (GameObject s in Sword) { s.SetActive(false); } } Hook = GameObject.FindGameObjectWithTag("Hook"); if (!Hook) { Debug.LogWarning("No hook found"); } grapplingHook = GetComponent <GrapplingHook>(); if (!grapplingHook) { Debug.LogWarning("No script grappling found"); } mainCamera = Camera.main; if (mainCamera == null) { Debug.LogWarning("No main camera"); } }
private void Respawn() { transform.position = respawnPoint.position; health = maxHealth; gameObject.GetComponent <Rigidbody>().velocity = Vector3.zero; // reset velocity to stop pre respawn movement GrapplingHook grapplingHook = GetComponentInChildren <GrapplingHook>(); if (grapplingHook) { grapplingHook.StopGrapple(); } }
private void OnCollisionEnter(Collision other) { if (GameObject.Equals(other.gameObject, GameObject.Find("Cat Lite"))) { catmovement.gameover = true; GrapplingHook hook = GameObject.FindGameObjectWithTag("Player").GetComponent <GrapplingHook>(); if (hook.hooked == true) { hook.ReturnHook(); } } }
private void Start() { player = GameObject.FindGameObjectWithTag("Player"); if (player) { grappling = player.GetComponent <GrapplingHook>(); } if (!grappling) { Debug.LogWarning("No grappling hook script found"); } }
private void Awake() { mc = GetComponent <MovementController>(); mc.OnLanding += OnLanding; cam = Camera.main; health = GetComponent <Health>(); health.OnDeath += OnDeath; fps = cam.GetComponent <FirstPersonCamera>(); digger = GetComponent <Digger>(); audioSource = GetComponent <AudioSource>(); grapplingHook = GetComponent <GrapplingHook>(); digger.DigSize = DigSize; }
public void Start() { if (TutorialCamera.Enabled()) { enabled = false; return; } else { enabled = true; initialCameraPosition = transform.position; initialCameraRotation = transform.rotation; AmbientNoise.Play(); PauseButton.paused = false; player = GameObject.Find("Player"); grapplingHook = player.GetComponent<GrapplingHook>(); playerMovements = player.GetComponent<PlayerMovements>(); //ControlManager.Disabled = true; if (!GameRecorder.playingBack) { GameRecorder.StopPlayback(); if (LevelSelectGUI.currentLevel != null) GUIController.ShowText("LevelName", LevelSelectGUI.currentLevel.name); #if UNITY_ANDROID || UNITY_IPHONE GUIController.ShowText("Text", "Tap to begin"); #else GUIController.ShowText("Text", "Click to begin"); #endif GUIController.GUILevelPause(); GUIController.HideText("Paused"); } EnableCameraController(); } }
public void init() { pos = Map.grid.grid_to_world(Map.grid.world_to_grid(transform.position)); current_node = Map.grid.get_node(Map.grid.world_to_grid(pos)); controller = GetComponent<Controller2D>(); controller.init(); player_movement = GetComponent<PlayerMovement>(); player_movement.init(); Transform weapon_obj = transform.parent.FindChild("weapon_base"); if (weapon_obj == null) Debug.LogError("'weapon_base' object cannot be found in player parent's children"); inventory = weapon_obj.GetComponent<WeaponInventory>(); inventory.init(this); weapon_control = weapon_obj.GetComponent<PlayerWeaponControl>(); weapon_control.init(); grappling_hook = GetComponent<GrapplingHook>(); grappling_hook.init(); health = GetComponent<GenericHealth>(); health.init(this); }
public void OnSceneGUI () { if (myTarget == null) { myTarget = (GrapplingHook)target; oldTimeToChange = myTarget.timeToChangeLength; oldSpeed = myTarget.changeSpeed; } Color c =Color.green; c.a=0.1f; Handles.color=c; Handles.DrawSolidDisc(((GrapplingHook)target).transform.position,Vector3.forward,((GrapplingHook)target).range); if (oldTimeToChange != myTarget.timeToChangeLength) { float oldChangeSpeed = myTarget.changeSpeed; myTarget.changeSpeed *= (myTarget.timeToChangeLength / oldTimeToChange); if (float.IsNaN(myTarget.changeSpeed)) { myTarget.changeSpeed = oldChangeSpeed; } } if(oldSpeed!=myTarget.changeSpeed&&myTarget.changeSpeed<0){ myTarget.changeSpeed = oldSpeed; } if (oldTimeToChange != myTarget.timeToChangeLength && myTarget.timeToChangeLength < 0) { myTarget.timeToChangeLength = oldTimeToChange; } oldSpeed = myTarget.changeSpeed; oldTimeToChange = myTarget.timeToChangeLength; }
void Start() { grapplingHook = GameObject.Find("Player").GetComponent<GrapplingHook>(); }
public void getHook() { hook = GetComponentInChildren<GrapplingHook>(); }
void Start() { hasFinished = false; player = GameObject.Find("Player"); grapplingHook = player.GetComponent<GrapplingHook>(); if (playerWarningPrefab != null) playerWarning = GameObject.Instantiate(playerWarningPrefab) as GameObject; }
void Awake() { grapplingHook = gameObject.GetComponent<GrapplingHook>(); playerMovement = gameObject.GetComponent<PlayerMovements>(); }
void Awake() { instance = this; grappleScript = GetComponent<GrapplingHook>(); if (enableLine && lineRenderer == null) { GameObject obj = new GameObject("Trail renderer"); linePoints = new Queue<Vector3>(); lineRenderer = obj.AddComponent<LineRenderer>(); lineRenderer.material.shader = Shader.Find("Particles/Additive"); lineRenderer.SetColors(Color.clear, lineColour); points = 1; lineRenderer.SetVertexCount(points); lineRenderer.SetWidth(0.3f, 0.3f); lineRenderer.enabled = true; } }
public void Start() { myTarget = (GrapplingHook)target; }