private void OnCollisionEnter2D(Collision2D collision) { Hookable hookable = collision.collider.GetComponent <Hookable>(); if (hookable != null) { switch (hookable.Weight) { case Weight.Light: OnHookHitLightHookable.Raise(); break; case Weight.Medium: OnHookHitMediumHookable.Raise(); break; case Weight.Heavy: OnHookHitHeavyHookable.Raise(); break; } } rigidbody2D.bodyType = RigidbodyType2D.Kinematic; rigidbody2D.velocity = Vector2.zero; rigidbody2D.angularVelocity = 0.0f; }
void OnCollisionEnter(Collision other) { IsColliding = true; _rigidbody.velocity = Vector3.zero; HookedObject = other?.gameObject.GetComponent <Hookable>(); }
// Token: 0x060008CF RID: 2255 RVA: 0x00027680 File Offset: 0x00025880 internal static void Refresh() { ConfigurationADImpl configurationADImpl = (ConfigurationADImpl)Configuration.hookableInstance.Value; Configuration.hookableInstance = Hookable <ICacheConfiguration> .Create(true, new ConfigurationADImpl()); configurationADImpl.Dispose(); }
static ActivitySchema() { Dictionary <string, PropertyDefinition> dictionary = new Dictionary <string, PropertyDefinition>(ActivitySchema.hookablePropertyCollection.Value.Count); foreach (PropertyDefinition propertyDefinition in ActivitySchema.hookablePropertyCollection.Value) { dictionary.Add(propertyDefinition.Name, propertyDefinition); } ActivitySchema.hookablePropertyNameToPropertyDefinitionMapping = Hookable <ReadOnlyDictionary <string, PropertyDefinition> > .Create(true, new ReadOnlyDictionary <string, PropertyDefinition>(dictionary)); }
public void StopDocking() { hookingStep = 2; SwitchJoysickToUndock[0].SetActive(true); SwitchJoysickToUndock[1].SetActive(false); if (pudge != null) { pudge.Buttons[1].SetActive(true); pudge = null; } }
public void LetGo() { if (HookedObject == null) { _collider.enabled = true; return; } if (_hookedObjectOriginalParent == null) { _collider.enabled = true; return; } HookedObject.transform.SetParent(_hookedObjectOriginalParent, worldPositionStays: true); _hookedObjectOriginalParent = null; HookedObject.RigidBody.isKinematic = false; HookedObject = null; _collider.enabled = true; }
static AuditingOpticsLogger() { AuditingOpticsLogger.auditingOpticsLoggerInstanceHook = Hookable <IAuditingOpticsLoggerInstance> .Create(true, null); }
internal static IDisposable SetActivityIdTestHook(Guid actId) { AuditingOpticsLoggerInstance.hookableActivityId = Hookable <Guid> .Create(true, Guid.Empty); return(AuditingOpticsLoggerInstance.hookableActivityId.SetTestHook(actId)); }
// Start is called before the first frame update void Start() { CS = new Weapon[Cannons.Length]; hp = gameObject.GetComponent <Health>(); hookAble = gameObject.GetComponent <Hookable>(); }
// Update is called once per frame void Update() { transform.Rotate(0, 200 * Time.deltaTime, 0); if (_cooldown <= 0) { _cooldown = OverlapSphereCooldown; hitColliders = Physics.OverlapSphere(transform.position, 50); } else { _cooldown -= Time.deltaTime; } foreach (Collider c in hitColliders) { GameObject Victim = c.gameObject; Health hpp = Victim.GetComponent <Health>(); if (hpp != null) { hpp.Radiation -= 2 * Time.deltaTime; } if (Victim.tag == "Enemy") { float dist = Vector3.Distance(Victim.transform.position, transform.position); Hookable H = Victim.GetComponent <Hookable>(); if (H == null) { Suck(Victim, dist, 200); } //if Meteor else if (H.hookable) { Suck(Victim, dist, 1000); H.UnHooked(); } //if Hookable Ship else { Suck(Victim, dist, 3); } //if a Normal Ship if (dist < 1) { Health hp = Victim.GetComponent <Health>(); if (hp != null) { hp.Hp = 0; } if (H != null) { if (H.Player != null) { if (Vector3.Distance(H.Player.transform.position, transform.position) < 50) //Gain Money From It if youre close enough { Currency C = H.Player.transform.parent.GetComponent <Currency>(); if (C != null) { int r = Random.Range(1, H.MaxStartMoney / 5); C.PopupMoney(gameObject, r); C.Money += r; } } } } } } } }
public void HookingMechanic() { if (TheHook.activeSelf == true) //Set Rope { LR.SetPosition(0, transform.position); LR.SetPosition(1, TheHook.transform.position); } if (TheHooked != null) { if (TheHooked.activeSelf == false) //Target is dead... Stop Hooking { hookingStep = 0; TheHooked = null; SwitchJoysickToUndock[0].SetActive(true); SwitchJoysickToUndock[1].SetActive(false); } } if (hookingStep < 3) { foreach (GameObject P in Pirates) { if (P?.activeSelf == true) { float pdist = Vector3.Distance(P.transform.position, transform.position); P.transform.position = Vector3.MoveTowards(P.transform.position, transform.position, (pdist * 0.01f) + 5 * Time.deltaTime); P.transform.LookAt(transform.position); if (pdist < 0.01f) { P.SetActive(false); } } } if (PiratesRaiding) { StartCoroutine(SpawnPirates(TheHooked)); PiratesRaiding = false; } } if (hookingStep == 0) // Hook Back / Not Hooking { if (TheHook.activeSelf == true) { TheHook.transform.LookAt(transform.position); TheHook.transform.rotation = Quaternion.Euler(new Vector3() { x = TheHook.transform.rotation.x, y = TheHook.transform.rotation.y + 180, z = TheHook.transform.rotation.z }); TheHook.transform.position = Vector3.MoveTowards(TheHook.transform.position, transform.position, 30 * Time.deltaTime); //hook goes back to ship float dist = Vector3.Distance(TheHook.transform.position, transform.position); if (dist < 1 || dist > 30) { TheHook.SetActive(false); } } } else { if (hookingStep == 1) //hook Forward { float dist = Vector3.Distance(TheHook.transform.position, TheHooked.transform.position); // Hook Distance TheHook.transform.LookAt(TheHooked.transform.position); TheHook.transform.position = Vector3.MoveTowards(TheHook.transform.position, TheHooked.transform.position, 20 * Time.deltaTime); if (dist < 1) { hookingStep = 2; } if (dist > 30) { StopHooking(); } } if (hookingStep == 2) //hook Connected { float dist = Vector3.Distance(transform.position, TheHooked.transform.position); // Enemy Distance TheHook.transform.position = TheHooked.transform.position; if (dist < TheHookedRange && !docked && NotMoving) { hookingStep = 3; docked = true; MilkingTime = MilkTime; StartCoroutine(SpawnPirates(gameObject)); PiratesRaiding = true; } else if (dist > 10) { docked = false; } float PullStrength = 1; if (dist > 20) { PullStrength = 2f; } else if (dist > 15) { PullStrength = 1.6f; } else if (dist > 10) { PullStrength = 1.4f; } else if (dist > 8) { PullStrength = 1.2f; } if (NotMoving) { PullStrength *= 3; } TheHooked.transform.position = Vector3.MoveTowards(TheHooked.transform.position, gameObject.transform.position, dist * PullStrength * Time.deltaTime); if (dist > 30) { StopHooking(); } } if (hookingStep == 3) //Docked { if (pudge == null) { pudge = TheHooked.GetComponent <Hookable>(); } float dist = Vector3.Distance(transform.position, TheHooked.transform.position); // Enemy Distance TheHook.transform.position = TheHooked.transform.position; SwitchJoysickToUndock[0].SetActive(false); SwitchJoysickToUndock[1].SetActive(true); foreach (GameObject P in Pirates) { if (P?.activeSelf == true) { float pdist = Vector3.Distance(P.transform.position, TheHooked.transform.position); P.transform.position = Vector3.MoveTowards(P.transform.position, TheHooked.transform.position, ((pdist * 1f) + 0.6f) * Time.deltaTime); P.transform.LookAt(TheHooked.transform.position); if (pdist < 0.01f) { P.SetActive(false); } } } float PullStrength = 1; if (dist > TheHookedRange + 3) { PullStrength = 2f; } else if (dist > TheHookedRange + 2) { PullStrength = 1.6f; } else if (dist > TheHookedRange + 1) { PullStrength = 1.4f; } else if (dist > TheHookedRange) { PullStrength = 1.2f; } TheHooked.transform.position = Vector3.MoveTowards(TheHooked.transform.position, gameObject.transform.position, dist * PullStrength * Time.deltaTime); if (MilkingTime <= 0 && dist < 5) { MilkingTime = MilkTime; if (pudge != null) { if (pudge.Money > 10) { int r = Random.Range(2, 5); currency.PopupMoney(TheHooked, pudge.Money / r); currency.Money += pudge.Money / r; pudge.Money -= pudge.Money / r; } else if (pudge.Money > 0) { currency.PopupMoney(TheHooked, pudge.Money); currency.Money += pudge.Money; pudge.Money = 0; } } } else { MilkingTime -= Time.deltaTime; } if (dist > 20) { StopHooking(); } } } }