public GameObject GetObjectByType(ComradeType type) { if (dict.ContainsKey(type)) { return(dict[type]); } else { return(null); } }
public virtual void AddBody(ComradeType type, int number) { Vector3 pos = new Vector3(100, 100); GameObject body = (GameObject)Instantiate(ComradeManager.Instance.GetObjectByType(type), pos, Quaternion.identity, transform); BaseBody baseBody = body.GetComponent <BaseBody>(); try { baseBody.recorder = bodies[0].GetComponent <BaseBody>().recorder; baseBody.SetNumber(number, distance); baseBody.speed = speed; baseBody.linePlayer = this; baseBody.Turn(Direction.FOLLOW); } catch (Exception e) { Debug.Log("Error Create"); } bodies.Add(body); }