void Throw(Vector2 direction) { EggScript egg = carrying; carrying = null; egg.Throw(direction); }
private void SpawnEgg(EggScript egg) { GenericSpawnPoint spawnPoint = EggSpawnPoints[Random.Range(0, EggSpawnPoints.Count - 1)]; SpawnObject(spawnPoint.transform.position, egg.gameObject); }
void Transfer(PlayerScript otherPlayer) { EggScript egg = carrying; carrying = null; otherPlayer.PickUp(egg); }
void Awake() { if (s_instance != null) { Destroy(this); } s_instance = this; DontDestroyOnLoad(this); }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Egg") { Debug.Log($"{this.name} bumped into {other.gameObject.name}"); EggScript egg = other.gameObject.GetComponent <EggScript>(); PickUp(egg); } }
private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1) { if (arg0.name.Contains("Stage")) { egg = ModAssets.Instantiate <GameObject>("Easter_pre"); } else { EggScript.DestroyEggScript(); UnityEngine.Object.Destroy(egg); egg = null; } }
private void Init() { while (players.Count < PlayerAmount) { players.Add(Instantiate(PlayerPrefab)); players[players.Count - 1].Respawns = PlayerRespawns; } for (int enemyIdx = 0; enemyIdx < EnemiesAmount; enemyIdx++) { enemies.Add(Instantiate(EnemyPrefab)); enemies[enemyIdx].gameObject.SetActive(false); } egg = Instantiate(EggPrefab); }
public void EggCrash(EggScript egg, PlayerScript lastPlayer) { List <PlayerScript> recievingPlayers = new List <PlayerScript>(); foreach (var player in players) { if (player != lastPlayer) { recievingPlayers.Add(player); } } PlayerScript recievingPlayer = recievingPlayers[Random.Range(0, recievingPlayers.Count)]; recievingPlayer.PickUp(egg); }
// Use this for initialization void Start() { selectedCube = null; tempCube = null; displayCube = null; mainCamera = Camera.main; if (canvas != null) { canvasScript = canvas.GetComponent <DestroyMode_CanvasScript>(); canvasScript.ChangeText("Team " + currentTeam); } allCubes = GameObject.FindGameObjectWithTag("AllCubes"); allBoundingFloors = GameObject.FindGameObjectWithTag("AllBoundingFloors"); numTeams = allBoundingFloors.transform.childCount; boundingFloors = new GameObject[numTeams]; for (int i = 0; i < boundingFloors.Length; i++) { boundingFloors[i] = allBoundingFloors.transform.GetChild(i).gameObject; } cubes = GameObject.FindGameObjectsWithTag("Cube"); for (int i = 0; i < cubes.Length; i++) { cubes[i].GetComponent <Rigidbody>().isKinematic = false; } GameObject[] allEggs = GameObject.FindGameObjectsWithTag("Egg"); eggs = new EggScript[numTeams]; for (int i = 0; i < numTeams; i++) { EggScript eScript = allEggs[i].GetComponent <EggScript>(); eggs[eScript.team] = eScript; } UpdateHealth(); }
void Start() { posx = PlayerPrefs.GetFloat("Player_Position_X"); posy = PlayerPrefs.GetFloat("Player_Position_Y"); posz = PlayerPrefs.GetFloat("Player_Position_Z"); Vector3 here = new Vector3(posx, posy, posz); transform.position = here; Time.timeScale = 1f; optionsPanel.SetActive(false); eggs = GetComponent <EggScript> (); died = false; playerFall = false; rb = GetComponent <Rigidbody> (); anime = GetComponent <Animator> (); var aSource = GetComponents <AudioSource> (); jumpSound = aSource [0]; boostSound = aSource [1]; eggSound = aSource [2]; }
void OnTriggerEnter2D(Collider2D collider) { //Debug.Log("hit"); // Collision with enemy EnemyScript enemy = collider.gameObject.GetComponent <EnemyScript>(); if (enemy != null) { // Kill the mosquito enemy MosquitoHealthScript enemyHealth = enemy.GetComponent <MosquitoHealthScript>(); if (enemyHealth != null) { enemyHealth.Damage(attackDamage); } } //collide with ameba AmebaMoveScript ameba = collider.gameObject.GetComponent <AmebaMoveScript>(); if (ameba != null) { Debug.Log("ameba"); switch (ameba.type) { case 1: Debug.Log("Heal Powerup"); GameObject.Find("Scripts").GetComponent <HealthScript>().DamageBody(-amebaHealAmount); break; case 2: Debug.Log("Double Width Powerup"); float powerupWidth = gameObject.transform.localScale.x * widthSizeScale; if (powerupWidth > 15) { powerupWidth = 15.0f; } gameObject.transform.localScale = new Vector3(powerupWidth, gameObject.transform.localScale.y, gameObject.transform.localScale.z); sizePowerupCooldown = sizePowerUpTimeLength; big = true; break; } // play noise AudioSource[] sounds = GetComponents <AudioSource>(); AudioSource deathNoise = sounds[ameba.type - 1]; deathNoise.Play(); Destroy(ameba.gameObject); } //collide with egg EggScript egg = collider.gameObject.GetComponent <EggScript>(); if (egg != null) { Debug.Log("blast off egg"); egg.HitByPlayer(); } // attack phase 2 boss KingMosquitoScript km = collider.gameObject.GetComponent <KingMosquitoScript>(); if (km != null) { km.HitByPlayer(attackDamage); } }
public void OnGameStageUnloaded() { EggScript.DestroyEggScript(); UnityEngine.Object.Destroy(egg); egg = null; }
void Drop() { carrying.Drop(); carrying = null; }
public void PickUp(EggScript egg) { egg.PickUp(eggCarry); carrying = egg; }