private void MakeOrbital(GameObject prefab) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(prefab, Owner.transform.position, Quaternion.identity); PlayerOrbital component = gameObject.GetComponent <PlayerOrbital>(); if (Owner) { component.Initialize(Owner); LibramOrbitalController orbcon = gameObject.GetComponent <LibramOrbitalController>(); if (orbcon) { orbcon.owner = Owner; } } currentOrbitals.Add(gameObject); }
public static GameObject CreateOrbital(PlayerController owner, GameObject targetOrbitalPrefab, bool isFollower, PlayerOrbitalItem sourceItem = null) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(targetOrbitalPrefab, owner.transform.position, Quaternion.identity); if (!isFollower) { PlayerOrbital component = gameObject.GetComponent <PlayerOrbital>(); component.Initialize(owner); component.SourceItem = sourceItem; } else { PlayerOrbitalFollower component2 = gameObject.GetComponent <PlayerOrbitalFollower>(); if (component2) { component2.Initialize(owner); } } return(gameObject); }