private void OnTriggerEnter(Collider collider) { IsObstacle obstacleScript = (IsObstacle)Utility.GetComponentInParents <IsObstacle>(collider.transform);// collider.GetComponent<IsObstacle>(); if (obstacleScript == null) { return; } obstacleScript.DestroySelf(); }
void ManageSpawn() { if (/*m_sequnces.m_sequences == null ||*/ m_sequnces.m_sequences.Count == 0) { return; } List <SpawnSequence.Sequence> spawns = new List <SpawnSequence.Sequence>(); List <SpawnSequence.Sequence> l = m_sequnces.m_sequences[m_currentSequenceIndex].ManageSequence(m_relativeRestrictionPos, m_relativeRestrictionNeg); if (l == null) { return; } for (int i = 0; i < l.Count; i++) { spawns.Add(l[i]); } for (int i = 0; i < spawns.Count; i++) { GameObject spawnedObject = Instantiate(m_spawnPrefab, transform); Vector3 scale = m_screenshotScript.GetObstacleScale(spawnedObject.transform.localScale, 0); IsObstacle obstacleScript = spawnedObject.GetComponent <IsObstacle>(); if (scale != Vector3.zero) { obstacleScript.GetCaptureCameraTransform().transform.localScale = scale; } spawnedObject.GetComponent <Rigidbody>().velocity = spawns[i].velocity; spawnedObject.transform.position = spawns[i].position; obstacleScript.SetLevelOptionsScript(m_levelOptions); obstacleScript.SetSpawnObstaclesScript(this); m_activeObstacles.Add(obstacleScript); } }
public void RemoveActiveObstacle(IsObstacle obstacle) { m_activeObstacles.Remove(obstacle); }