// Use this for initialization void OnEnable() { if (endPoint == null) { endPoint = transform.Find("EndPoint"); } baseAttachSpring = GetComponent <SpringJoint2D>(); endAttachSpring = endPoint.GetComponent <SpringJoint2D>(); //AttachBase(connectBody); //joints = new List<Joint>(); WiggleTime = Random.Range(0.0f, 10.0f); if (!segmentsGenerated && autoGenerateSegments) { if (pack == null) { pack = GetComponent <TentaclePack>(); } GenerateSegments(); for (int i = 0; i < prewarm; i++) { AdjustJoints(); } } audioSource = endPoint.gameObject.AddComponent <AudioSource>(); audioSource.spatialBlend = 1.0f; audioSource.minDistance = 1; audioSource.maxDistance = 30; }
public static Tentacle Basic(TentaclePack pack, float length = 10) { Tentacle tentComp = Ungenerated(); tentComp.pack = pack; tentComp.alternateSprites = true; tentComp.length = length; tentComp.segments = (int)(length * 2); tentComp.pullLength = 0; tentComp.jointWeight = 0.16f; tentComp.jointDrag = 0.9f; tentComp.useWiggle = true; tentComp.wiggleStrength = 0.16f; tentComp.wiggleSpeed = 1.0f; tentComp.startWidth = 1.2f; tentComp.endWidth = 0.5f; tentComp.GenerateSegments(); return(tentComp); }