// Use this for initialization void Start() { //Get the player, enemy and mushroom scripts in order to use them later playerScript = gameObject.GetComponent <MainPlayerScript>(); charName = playerScript.playerName; enemyScript = GameObject.Find("EnemyPlayer").GetComponent <EnemyPlayerScript>(); mushroomScript = gameObject.GetComponent <Mushroom>(); //A string which holds the path to the database, which will be called in a function later on string conn = "URI=file:" + Application.dataPath + "/kristiyan_nenov_cw.db"; IDbConnection dbconn; //creates a db connection entity dbconn = (IDbConnection) new SqliteConnection(conn); //opens the sqlite connection through the connection entity dbconn.Open(); //Open connection to the database. dbcmd = dbconn.CreateCommand(); //Uses the create command functionality, which enables script-like queries to the database PlayerTable(); EnemyTable(); CountMushrooms(); SpawnMushrooms(); //Closes everything and makes sure all values are set to null dbcmd.Dispose(); dbcmd = null; dbconn.Close(); dbconn = null; }
void OnCollisionEnter(Collision c) { if (IsTriggered && c.collider.gameObject.name == "Player") { MainPlayerScript.GameOver(); } }
protected override void OnInteraction() { base.OnInteraction(); MainPlayerScript.ChangeScore(1000); MainPlayerScript.GameWon(); }
public void Restart() { Destroy(player); Destroy(enemy); /// magicEffectManager.Clear(); /// player = Instantiate(playerPrefab); playerScript = player.GetComponent <MainPlayerScript>(); SelectPlayerAbilities(); canvas.GetComponent <ButtonControl>().UpdateIcon(); SpawnNewEnemy(); playerTurn = true; enemyTurn = false; enemyDCount = 0; turnCount = 0; skeletonKillsRewardCoin = 0; lvlRewardCoin = 0; totalCoin = 0; player.GetComponent <PlayerBackGroundMovement>().Move = true; showPopUpMenuButton.SetActive(true); GameObject.FindGameObjectWithTag("Canvas").GetComponent <ButtonControl>().ChangeButtonToUnPressed(); playerScript.UnBlockButtons(); }
protected override void OnInteraction() { base.OnInteraction(); MainPlayerScript.ChangeScore(50); Destroy(gameObject); }
void Start() { m_CurrentCheckPointIndex = 0; m_FailedToPassCheckPointSound = GetComponent <AudioSource>(); m_MainPlayerScript = m_Player.GetComponent <MainPlayerScript>(); m_EnemiesManagerScript = m_EnemiesManagerObject.GetComponent <EnemiesManager>(); }
public void RandomizeStats(int coeff) { MainPlayerScript playerScript = mainBattleScript.PlayerScript; // maxHealthPoint = 25 + Random.Range(1, 10) + 15 * coeff; //scale MaxHP with player hp //MaxHP += playerScript.HP / 4; // healthPoint = maxHealthPoint; // healingPer = 20; // armor = Random.Range(1, 10) + 1 * coeff; //scale Armor with player armor //Armor += Mathf.RoundToInt(playerScript.GetArmor/10); if (armor > 99) { armor = 99; } // armorBuffPer = 20; // damage = 5 + 10 * coeff + Random.Range(1, 5); //scale damage with player damage //Damage += playerScript.Damage/3; // Agility = 15 + Random.Range(1, 10); }
void Start() { m_MainPlayerScript = m_MainPlayer.GetComponent <MainPlayerScript>(); m_MainPlayerScript.NumberOfLivesChanged += OnLivesChange; m_MainPlayerScript.ScoreChanged += OnScoreChange; m_MainPlayerScript.PlayerCrashed += OnPlayerCrash; m_MainPlayerScript.LevelCompleted += OnLevelComplete; m_Score.text = "Score: 0"; }
void Start() { m_GameOverScript = m_GameOverCanvas.GetComponent <GameOverMenuScript>(); m_MainPlayerScript = m_MainPlayer.GetComponent <MainPlayerScript>(); m_MainPlayerScript.GameOver += GameOver; //Subscribe as a listener to the GameOver event m_EnemiesManagerScript = m_EnemyManager.GetComponent <EnemiesManager>(); m_CheckPointManagerScript = m_CheckPointsParentObject.GetComponent <CheckPointsManager>(); m_GameCompletedAudioSource = GetComponent <AudioSource>(); }
protected override void OnInteraction() { base.OnInteraction(); MainPlayerScript.ChangeScore(100); Destroy(Door); IsInteractable = false; Highlighted(false); }
public void CheckUpgrade(int ButtonNum) { MainPlayerScript MainPS = battleScript.PlayerScript; switch (CurrentUpgrades[--ButtonNum].upgradeName) { case "Damage": MainPS.ChangeDamage(CurrentUpgrades[ButtonNum].upgradeValue); break; case "Health": MainPS.ChangeMaxHealthPoint(CurrentUpgrades[ButtonNum].upgradeValue); break; case "RandomizeSkills": battleScript.SelectPlayerAbilities(); break; case "RestoreHealth": MainPS.RestoreHealth(); break; case "X2Armor": MainPS.ChangeArmor(MainPS.Armor); break; case "X2Coin": battleScript.ChangeSkeletonKillsRewardCoin(battleScript.SkeletonKillsRewardCoin); break; case "X2Damage": MainPS.ChangeDamage(MainPS.Damage); break; case "HealingBuffUpgrade": MainPS.UpdateHealingPer(CurrentUpgrades[ButtonNum].upgradeValue); break; case "ArmorBuffUpgrade": MainPS.UpdateArmorBuffPer(CurrentUpgrades[ButtonNum].upgradeValue); break; } GetComponent <Animator>().SetBool("Close", true); }
public void Start() { GetComponent <LocalizationScript>().Start(); player = Instantiate(playerPrefab); playerScript = player.GetComponent <MainPlayerScript>(); magicEffectManager = GetComponent <MagicEffectManagerScript>();//new MagicEffectManager(); SelectPlayerAbilities(); SpawnNewEnemy(); enemyDCount = 0; strengthCoeff = 0; turnCount = 0; skeletonKillsRewardCoin = 0; lvlRewardCoin = 0; totalCoin = 0; if (GetComponent <SaveScript>().SaveObj == null) { GetComponent <SaveScript>().Awake(); } lvl = GetComponent <SaveScript>().SaveObj.lvl; exp = GetComponent <SaveScript>().SaveObj.exp; }
void Start() { if (distance == 0.0f) distance = 10.0f; if (panTime == 0f) panTime = 3f; speed = 0f; curTime = 0f; waitAfterPanning = 0f; isPanning = false; newPosition = Vector2.zero; normalizedError = Vector3.one; camDist = new Vector3(0,-height,distance); lookAtTarget = target.position; transform.position = target.position - camDist; oldStyle = true; player = GameObject.FindGameObjectWithTag ("Player").GetComponent<MainPlayerScript>(); }
private void Start() { sceneManager = GameObject.Find("SceneManager").GetComponent <LoadSceneManager>(); mainPlayerScript = GetComponent <MainPlayerScript>(); }
// Use this for initialization void Start() { instantiatedBoulders = new System.Collections.Generic.List<GameObject>(); for (int i = 0; i < 3; i ++) { GameObject boulder = Instantiate (boulders [i], boulderSpawn.position, Quaternion.identity) as GameObject; boulder.transform.localScale = new Vector3 (2f, 2f, 2f); instantiatedBoulders.Add (boulder); } // Instantiate (breakPform, breakPformPos.position, Quaternion.identity); // Instantiate (blockBoulder, blockBoulderPos.position, Quaternion.identity); blockBoulderPosition = new Vector3 (blockBoulderPos.position.x, blockBoulderPos.position.y, blockBoulderPos.position.z); blockBoulderRotation = new Quaternion (blockBoulderPos.rotation.x, blockBoulderPos.rotation.y, blockBoulderPos.rotation.z, blockBoulderPos.rotation.w); blockBoulderScale = new Vector3 (blockBoulderPos.localScale.x, blockBoulderPos.localScale.y, blockBoulderPos.localScale.z); player = GameObject.FindGameObjectWithTag ("Player").GetComponent<MainPlayerScript>(); }
void Start() { m_MainPlayerScript = m_Player.GetComponent <MainPlayerScript>(); m_ExtraLifeAudioSource = GetComponent <AudioSource>(); }
// Get the current scene // public string currentLevel; // public int currentLevelNum; // public float moveTimer; // Use this for initialization void Start() { cacheCurrentLevelIndex(); if (System.IO.File.Exists ("Save/currentSave")) System.IO.File.Delete ("Save/currentSave"); displayMessage = false; displayPauseMenu = false; bool mattyProfile = false; bool liquidProfile = false; bool solidProfile = false; bool gasProfile = false; bool plasmaProfile = false; panTriggerActive = false; displayTime = 0f; one = 1f; messageToBeDisplayed = ""; if (tipDisplayTime == 0f) tipDisplayTime = 10f; originalAmbientColor = RenderSettings.ambientLight; darknessTriggerSpots = new float [2]; sceneCamera = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<Transform>(); camFollow = sceneCamera.gameObject.GetComponent<CameraFollow>(); iciclesList = new System.Collections.Generic.List<IcicleBase> (); GameObject[] icicleBaseArray = GameObject.FindGameObjectsWithTag ("IceCeiling"); foreach (GameObject icicle in icicleBaseArray) iciclesList.Add (icicle.GetComponent<IcicleBase>()); darkCave = false; darkCavesList = new System.Collections.Generic.List<DarkCave>(); icicleBaseArray = GameObject.FindGameObjectsWithTag ("DarkCave"); foreach (GameObject darkCaveEnterX in icicleBaseArray) { DarkCave newCave; Transform dcTransform = darkCaveEnterX.GetComponent<Transform>(); Vector3 dcEnter = dcTransform.Find ("DarkCaveEnter").position; Vector3 dcExit = dcTransform.Find ("DarkCaveExit").position; newCave.Door1 = new Vector2 (dcEnter.x, dcEnter.y); newCave.Door2 = new Vector2 (dcExit.x, dcExit.y); darkCavesList.Add (newCave); } LoadTriggerMessagesFromFile (); GUIDimensionSetup (); // Creates a backup of the light intensities of all the lights in the scene. // This is needed since we need to lerp the light intensities to zero when player // enters dark caves. lights = GameObject.FindSceneObjectsOfType (typeof(Light)) as Light[]; origLightIntensities = new float [lights.Length]; for (int i = 0; i < lights.Length; i ++) origLightIntensities [i] = lights [i].intensity; // Creates a backup of the skybox assigned to the scene. // This is needed since we set the skybox to null as the player enters dark caves. origSkybox = RenderSettings.skybox; // Needed for dark caves. If background colour is not set to black, dark caves // won't be "dark" anymore. sceneCamera.gameObject.GetComponent<Camera>().backgroundColor = Color.black; // Define the GUIStyle to be used in the State Info Box at the bottom of the screen. stateInfoBox = new GUIStyle (); stateInfoBox.name = "StateInfoBox"; stateInfoBox.alignment = TextAnchor.LowerRight; stateInfoBox.font = menuFont; stateInfoBox.normal.textColor = Color.white; player = GameObject.FindGameObjectWithTag ("Player").GetComponent<MainPlayerScript>(); try { ld = GameObject.FindGameObjectWithTag ("LevelDirector").GetComponent<LevelDirector>(); } catch (System.Exception e) { Debug.LogWarning ("A Level Director was not found for this level!"); } try { levelStopwatch = GameObject.FindGameObjectWithTag("Stopwatch"); stopwatch = levelStopwatch.GetComponent<Stopwatch>(); if (PlayerPrefs.GetString(Constants.GameModeKey).Equals(Constants.GameModeSpeedRun)) { stopwatch.startStopwatch(); isSpeedRun = true; } player.setIsSpeedRun(isSpeedRun); } catch (System.NullReferenceException e) { Debug.LogWarning ("Stopwatch was not found for this level!"); } catch (System.Exception e) { Debug.LogError (e.Message); } mainCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>(); try { subcam = GameObject.FindGameObjectWithTag("SubsectionCamera"); subsectionCam = subcam.GetComponent<Camera>(); //subsectionCamPos = subcam.transform; subsectionCam.enabled = false; mainCam.enabled = true; } catch (System.Exception e) { Debug.LogWarning("No subsection camera was found"); } startSubsectCam = false; }