public ClickToMoveFollower Follower(CharacterMove currentChar) { ClickToMoveFollower follower = currentChar.GetComponent <ClickToMoveFollower>(); if (follower == null) { follower = currentChar.gameObject.AddComponent <ClickToMoveFollower>(); follower.clickToMoveUi = this; ParticleSystem ps = currentChar.GetComponentInChildren <ParticleSystem>(); if (ps != null) { ParticleSystem.MainModule m = ps.main; follower.color = m.startColor.color; } follower.Init(currentChar.gameObject); } return(follower); }
public void Init(GameObject go) { if (mover != null) { return; } mover = GetComponent <CharacterMove>(); CapsuleCollider cap = mover.GetComponent <CapsuleCollider>(); if (cap != null) { characterHeight = cap.height / 2; characterRadius = cap.radius; } else { characterHeight = characterRadius = 0; } if (line == null) { line = Lines.MakeWire(); } line.Line(Vector3.zero); }