//Bullet colitions private void OnTriggerEnter2D(Collider2D otherCollider) { LeftLine myLeftLine = otherCollider.gameObject.GetComponent <LeftLine>(); //get the sidelines RightLine myRightLine = otherCollider.gameObject.GetComponent <RightLine>(); //get the sidelines BottomLine myBottomline = otherCollider.gameObject.GetComponent <BottomLine>(); //get the Bottomline PlayerScript myPlayer = otherCollider.gameObject.GetComponent <PlayerScript>(); //get the Player EnemyScript myEnemy = otherCollider.gameObject.GetComponent <EnemyScript>(); //get the STD //if the collliding object is any sideline //if the collliding object is any sideline if (myRightLine != null) { MyAudioManager.BallBounce(); if (MovingStuffVelocity.x > 0) { MovingStuffVelocity.x *= -1; } MovingStuffVelocity = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y); MovingStuffRB.velocity = MovingStuffVelocity; //STDBallSpeedX *= -1; } //if the collliding object is bottomline if (myLeftLine != null) { MyAudioManager.BallBounce(); if (MovingStuffVelocity.x < 0) { MovingStuffVelocity.x *= -1; } MovingStuffVelocity = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y); MovingStuffRB.velocity = MovingStuffVelocity; //STDBallSpeedX *= -1; } //if the collliding object is bottomline else if (myBottomline != null) { transform.position = PointOutSideScreen; //bullet disappears MoveStdBullet = false; //StopBulletMovement myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text MyBlinkerCounter = 0; } else if (myPlayer != null) { MoveStdBullet = false; //StopBulletMovement transform.position = PointOutSideScreen; //bullet disappears //do stuff myPlayer.transform.localScale = new Vector2(PlayerScript.PlayerObjectSize.x / 2f, PlayerScript.PlayerObjectSize.y / 2f); //reduce player size by 50% PlayerScript.SharpCondomsPlayerSizeCounter = 1; //initiate the playersize counter StdPongPlayScript.intCurrentPlayerScore -= 3; //reduce player points myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text MyBlinkerCounter = 0; } }
void Start() { GlobalLineWidthSlider.value = DefaultLineWidth; GlobalShapeToleranceSlider.value = DefaultTolerance; JDI = JsonManager.GetComponent <JsonDataImport>(); // JsonDataImport JDI = JsonManager.GetComponent<JsonDataImport>(); AM = AudioManager.GetComponent <MyAudioManager>(); HA = JsonManager.GetComponent <HeightAdjust>(); }
void Awake() { if (ins != null && ins != this) { Destroy(this.gameObject); return; } ins = this; DontDestroyOnLoad(this.gameObject); InitData(); }
private void Start() { LabelText.text = OrbitManager.gameObject.name; OM = OrbitManager.GetComponent <OrbitManagement>(); TM = OrbitManager.GetComponent <TimeManipulator>(); JsonManager = GameObject.FindGameObjectWithTag("JsonManager"); HeightAdjust HA = JsonManager.GetComponent <HeightAdjust>(); Pedestal = HA.Pedestal; MainSatelliteCanvas = HA.MainSatelliteCanvas; MainMenuCanvas = HA.MainMenuCanvas; AudioManager = GameObject.FindGameObjectWithTag("AudioManager"); AM = AudioManager.GetComponent <MyAudioManager>(); }
void Awake() { _instance = this; managers = new List <IGameManager>(); playerManager = GetComponent <PlayerManager>(); uiManager = GetComponent <MyUIManager>(); itemManager = GetComponent <ItemManager>(); audioManager = GetComponent <MyAudioManager>(); managers.Add(playerManager); managers.Add(uiManager); managers.Add(itemManager); managers.Add(audioManager); StartCoroutine(StartSetupManager()); }
void Start() { GlobalLineWidthSlider.value = DefaultLineWidth; GlobalShapeToleranceSlider.value = DefaultTolerance; JDI = JsonManager.GetComponent <JsonDataImport>(); // JsonDataImport JDI = JsonManager.GetComponent<JsonDataImport>(); AM = AudioManager.GetComponent <MyAudioManager>(); HA = JsonManager.GetComponent <HeightAdjust>(); // WHY ARE THESE OBSOLETED? //GlobalScaleSlider.value = JDI.ScaleValue; //NewScaleValue = (int)GlobalScaleSlider.value; //CoordinatesText.text = "Coordinates: " + JDI.orbitalDataUnity.Info.Coordinates; //UnitsText.text = "Units: " + JDI.orbitalDataUnity.Info.Units; //defaults //UseTimeStepToggle.isOn = true; //TimeStepSlider.value = (float)timeSteps[3]; // 1 min }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); foreach (Sound s in Sounds) { s.source = gameObject.AddComponent <AudioSource>(); s.source.clip = s.clip; s.source.volume = s.volume; s.source.pitch = s.pitch; s.source.loop = s.loop; } }
//Ball colitions private void OnTriggerEnter2D(Collider2D otherCollider) { // Sidelines mySideline = otherCollider.gameObject.GetComponent<Sidelines>();//get the sidelines LeftLine myLeftLine = otherCollider.gameObject.GetComponent <LeftLine>(); //get the sidelines RightLine myRightLine = otherCollider.gameObject.GetComponent <RightLine>(); //get the sidelines TopLine myTopLine = otherCollider.gameObject.GetComponent <TopLine>(); //get the Topline BottomLine myBottomline = otherCollider.gameObject.GetComponent <BottomLine>(); //get the Bottomline PlayerScript myPlayer = otherCollider.gameObject.GetComponent <PlayerScript>(); //get the Player EnemyScript myEnemy = otherCollider.gameObject.GetComponent <EnemyScript>(); //get the STD //if the collliding object is any sideline if (myRightLine != null) { MyAudioManager.BallBounce(); if (STDBallVelocity.x > 0) { STDBallVelocity.x *= -1; } STDBallVelocity = new Vector2(STDBallVelocity.x, STDBallVelocity.y); STDBallRB.velocity = STDBallVelocity; //STDBallSpeedX *= -1; } if (myLeftLine != null) { MyAudioManager.BallBounce(); if (STDBallVelocity.x < 0) { STDBallVelocity.x *= -1; } STDBallVelocity = new Vector2(STDBallVelocity.x, STDBallVelocity.y); STDBallRB.velocity = STDBallVelocity; //STDBallSpeedX *= -1; } //if the collliding object is topline else if (myTopLine != null) { MyAudioManager.BallBounce(); if (STDBallVelocity.y > 0) { STDBallVelocity.y *= -1; } STDBallVelocity = new Vector2(STDBallVelocity.x, STDBallVelocity.y); STDBallRB.velocity = STDBallVelocity; StdPongPlayScript.MyEnemyHealth -= .10f; //reduce the enemy health StdPongPlayScript.intCurrentPlayerScore += 10; //increase player points } //if the collliding object is bottomline else if (myBottomline != null) { MyAudioManager.BallBounce(); if (STDBallVelocity.y < 0) { STDBallVelocity.y *= -1; } STDBallVelocity = new Vector2(STDBallVelocity.x, STDBallVelocity.y); STDBallRB.velocity = STDBallVelocity; StdPongPlayScript.MyPlayerHealth -= .05f; //reduce the player health StdPongPlayScript.intCurrentPlayerScore -= 10; //reduce player points } else if (myPlayer != null) { MyAudioManager.BallBounce(); int RandomDirection = Random.Range(1, 3); int RandomSlantX = Random.Range(5, 8); int RandomSlantY = Random.Range(6, 10); if (RandomDirection == 1) { STDBallVelocity = new Vector2(RandomSlantX * -1f, RandomSlantY * 1f); } else { STDBallVelocity = new Vector2(RandomSlantX * 1f, RandomSlantY * 1f); } STDBallRB.velocity = STDBallVelocity; } else if (myEnemy != null) { MyAudioManager.BallBounce(); int RandomDirection = Random.Range(1, 3); int RandomSlantX = Random.Range(5, 8); int RandomSlantY = Random.Range(6, 10); if (RandomDirection == 1) { STDBallVelocity = new Vector2(RandomSlantX * -1f, RandomSlantY * -1f); } else { STDBallVelocity = new Vector2(RandomSlantX * 1f, RandomSlantY * -1f); } STDBallRB.velocity = STDBallVelocity; } }
//Bullet colitions private void OnTriggerEnter2D(Collider2D otherCollider) { LeftLine myLeftLine = otherCollider.gameObject.GetComponent <LeftLine>(); //get the sidelines RightLine myRightLine = otherCollider.gameObject.GetComponent <RightLine>(); //get the sidelines BottomLine myBottomline = otherCollider.gameObject.GetComponent <BottomLine>(); //get the Bottomline PlayerScript myPlayer = otherCollider.gameObject.GetComponent <PlayerScript>(); //get the Player EnemyScript myEnemy = otherCollider.gameObject.GetComponent <EnemyScript>(); //get the STD //if the collliding object is any sideline //if the collliding object is any sideline if (myRightLine != null) { MyAudioManager.BallBounce(); if (MovingStuffVelocity.x > 0) { MovingStuffVelocity.x *= -1; } MovingStuffVelocity = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y); MovingStuffRB.velocity = MovingStuffVelocity; //STDBallSpeedX *= -1; } //if the collliding object is bottomline if (myLeftLine != null) { MyAudioManager.BallBounce(); if (MovingStuffVelocity.x < 0) { MovingStuffVelocity.x *= -1; } MovingStuffVelocity = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y); MovingStuffRB.velocity = MovingStuffVelocity; //STDBallSpeedX *= -1; } //if the collliding object is bottomline else if (myBottomline != null) { transform.position = PointOutSideScreen; //bullet disappears MovePowerUp = false; //StopBulletMovement myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text MyBlinkerCounter = 0; } else if (myPlayer != null) { MovePowerUp = false; //StopBulletMovement transform.position = PointOutSideScreen; //bullet disappears //do stuff StdPongPlayScript.MyPlayerHealth += 0.05f; //increace player immune by 5% StdPongPlayScript.intCurrentPlayerScore += 3; //reduce player points myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text MyBlinkerCounter = 0; PlayerPrefs.SetInt("PowerupCount", PlayerPrefs.GetInt("PowerupCount") + 1); //increase the overall count of powerups } }
private void Start() { OM = OrbitManager.GetComponent <OrbitManagement>(); GOAudioManager = GameObject.FindGameObjectWithTag("AudioManager"); AM = GOAudioManager.GetComponent <MyAudioManager>(); }
//Bullet colitions private void OnTriggerEnter2D(Collider2D otherCollider) { LeftLine myLeftLine = otherCollider.gameObject.GetComponent <LeftLine>(); //get the sidelines RightLine myRightLine = otherCollider.gameObject.GetComponent <RightLine>(); //get the sidelines BottomLine myBottomline = otherCollider.gameObject.GetComponent <BottomLine>(); //get the Bottomline PlayerScript myPlayer = otherCollider.gameObject.GetComponent <PlayerScript>(); //get the Player EnemyScript myEnemy = otherCollider.gameObject.GetComponent <EnemyScript>(); //get the STD //if the collliding object is any sideline //if the collliding object is any sideline if (myRightLine != null) { MyAudioManager.BallBounce(); if (MovingStuffVelocity.x > 0) { MovingStuffVelocity.x *= -1; } MovingStuffVelocity = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y); MovingStuffRB.velocity = MovingStuffVelocity; //STDBallSpeedX *= -1; } //if the collliding object is bottomline if (myLeftLine != null) { MyAudioManager.BallBounce(); if (MovingStuffVelocity.x < 0) { MovingStuffVelocity.x *= -1; } MovingStuffVelocity = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y); MovingStuffRB.velocity = MovingStuffVelocity; //STDBallSpeedX *= -1; } //if the collliding object is bottomline else if (myBottomline != null) { transform.position = PointOutSideScreen; //bullet disappears MovePowerUp = false; //StopBulletMovement myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text MyBlinkerCounter = 0; } else if (myPlayer != null) { MovePowerUp = false; //StopBulletMovement transform.position = PointOutSideScreen; //bullet disappears myPlayer.transform.localScale = new Vector2(PlayerScript.PlayerObjectSize.x * 2f, PlayerScript.PlayerObjectSize.y * 2f); //increase player size by 100% PlayerScript.SharpCondomsPlayerSizeCounter = 1; //initiate the playersize counter myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text MyBlinkerCounter = 0; //do stuff PlayerPrefs.SetInt("PowerupCount", PlayerPrefs.GetInt("PowerupCount") + 1); //increase the overall count of powerups } }