private void OnCustomEvent(string evt) { if (evt.Equals("Up")) { controller.AddForce(UpVelocity, ForceMode2D.Force); } if (evt.Equals("UpEnd")) { controller.ClearVelocity(); } }
private void OnCustomEvent(string evt) { var force = JumpBackVelocity; if (faceDirectionComponent.GetrRelativeHorizontalFaceDirection() == -1) { force.x = -force.x; } controller.AddForce(force, ForceMode2D.Force); controller.ActiveGravity = true; isJumpBack = true; var obj = Object.Instantiate(Resources.Load <GameObject> ("Prefabs/Object/Boss08_Atk02_Arrow")); obj.transform.position = Owner.transform.position + new Vector3(faceDirectionComponent.GetrRelativeHorizontalFaceDirection() == 1 ? Offset.x : -Offset.x, Offset.y); var comp = obj.GetComponent <Boss08_Atk02_Arrow> (); comp.DamageSource = Owner.name; comp.DamageKey = DamageKey; comp.FlySpeed = FlySpeed; if (faceDirectionComponent.GetrRelativeHorizontalFaceDirection() == 1) { comp.angle = Angle; } else { comp.angle = Angle + 180f - Angle * 2f; } comp.Dir = MathUtils.AngleToDirection(comp.angle); obj.transform.Find("renderer").SetLocalEulerAngles(null, null, comp.angle - 180f); obj.transform.Find("renderer/tail").SetLocalPosition(0f, 1f); }