public override void OnInspectorGUI() { ProjectileSpawn currentScript = (ProjectileSpawn)target; currentScript.enabled = EditorGUILayout.Toggle("Enabled", currentScript.enabled); currentScript.addRandomInertiaToProjectiles = EditorGUILayout.Toggle("Random Intertia", currentScript.addRandomInertiaToProjectiles); currentScript.inaccuracy = EditorGUILayout.FloatField("Inaccuracy", currentScript.inaccuracy); currentScript.emitRate = EditorGUILayout.FloatField("Emit Rate", currentScript.emitRate); currentScript.speed = EditorGUILayout.FloatField("Speed", currentScript.speed); m_Property = m_Object.FindProperty("objects"); EditorGUILayout.PropertyField(m_Property, new GUIContent("Objects"), true); m_Object.ApplyModifiedProperties(); currentScript.limitObjectsInScene = EditorGUILayout.Toggle("Limit Objects In Scene", currentScript.limitObjectsInScene); if (currentScript.limitObjectsInScene) { currentScript.limitAmount = EditorGUILayout.IntField("Max Objects", currentScript.limitAmount); EditorGUILayout.HelpBox("Deletes excessive objects in scene to reduce resource load. Set Limit above to max amount of objects.", MessageType.Info); } }
void Start() { lastTimeOfFiring = Time.time; targetGameObject = GameObject.FindGameObjectWithTag(TargetTag); projectileSpawn = GameObject.Find("Projectiles").GetComponent <ProjectileSpawn>(); }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { var spawnData = new ProjectileSpawn { Prefab = conversionSystem.GetPrimaryEntity(Prefab), PoolCount = PoolCount, Speed = Speed, CollisionSize = CollisionSize, PoolLocation = PoolLocation }; dstManager.AddComponentData(entity, spawnData); }
/******** PROTECTED ************************/ protected void Explode() { if (m_ProjectileSpawn == null) { return; } GameObject created = Instantiate(m_ProjectileSpawn, transform.parent); created.transform.localPosition = m_destination; ProjectileSpawn script = created.GetComponent <ProjectileSpawn>(); script.Direction = m_Direction; script.IsFromPlayer = m_isFromPlayer; Debug.Assert(script != null); }
void Shoot(ONEGeneral.Direction p_direction, GameObject p_projectileSpawn) { if (p_projectileSpawn == null) { return; } GameObject created = Instantiate(p_projectileSpawn, transform.parent); created.transform.localPosition = m_destination; ProjectileSpawn script = created.GetComponent <ProjectileSpawn>(); Debug.Assert(script != null); script.Direction = p_direction; script.PlayMyTurn(); ONESoundDesign.EnemyShoot(); }
public void Shoot(Transform p_parent, Vector3 p_position, ONEGeneral.Direction p_direction) { if (m_projectileSpawn == null || m_currentCooldown != 0) { Debug.Log("Can't shoot"); return; } GameObject created = Instantiate(m_projectileSpawn, p_parent); created.transform.localPosition = p_position; ProjectileSpawn script = created.GetComponent <ProjectileSpawn>(); script.IsFromPlayer = true; script.Direction = p_direction; Debug.Assert(script != null); m_currentCooldown = m_cooldown + 1; ONESoundDesign.PlayerShoot(); }
void Awake() { ProjectileSpawn.instance = this; }
void Start() { lastTimeOfFiring = Time.time; projectileSpawn = GameObject.Find("Projectiles").GetComponent <ProjectileSpawn>(); }