public void Init(GameObject gameObject) { m_Owner = gameObject; Move.Init(m_Owner); Essentials.Init(m_Owner); Status.Init(m_Owner); Behaviour.Init(m_Owner); Missions.Init(m_Owner); Interaction.Init(m_Owner); Environment.Init(m_Owner); CreatureRegister.Register(m_Owner); }
public void Spawn() { CreatureGroupObject _group = CreatureRegister.ForceCreatureGroup(Name); if (_group == null) { return; } m_CreaturesCount = _group.Creatures.Count; if (m_CreaturesCount < MaxCreatures) { Vector3 _position = GetSpawnPosition(); Quaternion _rotation = Random.rotation; _rotation.z = 0; _rotation.x = 0; GameObject _creature = (GameObject)Object.Instantiate(Creature, _position, _rotation); if (UseRandomScale) { RandomScaleMin = -1; RandomScaleMax = 1; float _scale_multiplier = (float)Random.Range(RandomScaleMin, RandomScaleMax) / 100 * UseRandomScaleMultiplier * 0.5f; _creature.transform.localScale = _creature.transform.localScale + (_creature.transform.localScale * _scale_multiplier); } _creature.name = Creature.name; if (UseGroupObject) { if (m_GroupObject == null) { m_GroupObject = new GameObject(); m_GroupObject.name = Name + "(Group)"; m_GroupObject.transform.position = Vector3.zero; if (Register != null) { Register.transform.position = Vector3.zero; m_GroupObject.transform.parent = Register.transform; } } _creature.transform.parent = m_GroupObject.transform; if (_creature.GetComponent <ICECreatureControl>() != null) { _creature.GetComponent <ICECreatureControl>().Creature.Status.Reset(); } _creature.SetActive(true); CreatureRegister.Register(_creature); } } }