private void OnDestroy() { if (this == Instance) { Instance = null; } }
void Awake() { QualitySettings.vSyncCount = 1; if (!mInstance) mInstance = this; else { Destroy(this.gameObject); return; } DontDestroyOnLoad(this.gameObject); clothesSettings = GetComponent<ClothesSettings>(); enemiesManager = GetComponent<EnemiesManager>(); gameData = GetComponent<GameData>(); gameSettings = GetComponent<GameSettings>(); areasManager = GetComponent<AreasManager>(); musicManager = GetComponent<MusicManager>(); soundManager = GetComponent<SoundManager>(); combosManager = GetComponent<CombosManager>(); specialItems = GetComponent<SpecialItemsManager>(); moodsManager = GetComponent<MoodsManager>(); texts = GetComponent<Texts>(); GetComponent<MusicManager>().Init(); GetComponent<SoundManager>().Init(); moodsManager.Init(); //#if UNITY_ANDROID || UNITY_IPHONE // Handheld.PlayFullScreenMovie(movPath, Color.black, FullScreenMovieControlMode.Hidden, FullScreenMovieScalingMode.AspectFill); //#endif }
void Start() { waitingTime = 1.2f; if (GameManager.levelNumber > 9) { StartCoroutine(ExecuteSpread()); } if (GameManager.levelNumber > 19) { waitingTime = 0.9f; } else if (GameManager.levelNumber > 25) { waitingTime = 0.6f; } else if (GameManager.levelNumber > 30) { waitingTime = 0.3f; } enemiesManager = GameObject.Find("EnemiesManager").GetComponent <EnemiesManager>(); }
public void Setup(EnemiesManager enemiesManager, GameManager gameManager) { this.enemiesManager = enemiesManager; this.gameManager = gameManager; audioSource = GetComponent <AudioSource>(); renderer = GetComponent <Renderer>(); }
private void Start() { shootPause = Random.Range(attackPause - 2, attackPause + 2); // pause after shoot attackTimer = shootPause / 2; rb = GetComponent <Rigidbody>(); EnemiesManager.increaseEnemyCounter(); }
void Update() { Attack(); if (Vector3.Distance(starship.position, this.transform.position) > 350) { EnemiesManager.decreaseEnemyCounter(); DestroyEnemy(); } if (health <= 0 && !isExploded) { EnemiesManager.decreaseEnemyCounter(); isExploded = true; GetComponent <Collider>().enabled = false; GetComponent <MeshRenderer>().enabled = false; GetComponent <TrailRenderer>().enabled = false; gameObject.layer = LayerMask.NameToLayer("Default"); healthBar.enabled = false; GetComponent <Outline>().enabled = false; StartCoroutine(Explode()); } healthBar.value = Mathf.Lerp(healthBar.value, health, Time.deltaTime * 6); }
// Use this for initialization void Start() { anim = GetComponent <Animator>(); AS = GetComponent <AudioSource>(); nav = GetComponent <NavMeshAgent>(); CanvaAnim = Canva.GetComponent <Animator>(); EM = GetComponentInParent <EnemiesManager>(); GBM = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameBooleanManager>(); SKM = GameObject.FindGameObjectWithTag("GameManager").GetComponent <SkillManager>(); GSM = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameSceneManager>(); player = GameObject.FindGameObjectWithTag("Player"); HeadingPosition = EM.NavChanged(); //初始化变量 foundRate = 0; nav.speed = 0.7f; isPatroling = true; if (HeadingPosition.Equals(new Vector3(0, 0, 0))) { standPosition = true; originPosition = transform.position; HeadingPosition = originPosition; } nav.SetDestination(HeadingPosition); foundRateSlider.value = foundRate; }
// Use this for initialization void Start() { textLifes.text = TEXT_LIFES + lifes; StartCoroutine(HeartSpawning()); enemiesManager = FindObjectOfType <EnemiesManager>(); infoPlayer = FindObjectOfType <InfoPlayer>(); }
public override void Start() { base.Start(); if (gameObject.GetComponent <BoundsCheck>() != null) { bound = gameObject.GetComponent <BoundsCheck>(); } else { Debug.LogWarningFormat("BoundsCheck not set to the enemy ship prefab of {0}", gameObject.name); } EnemiesManager enemiesManager = EnemiesManager.Instance; if (enemiesManager != null) { stats.shipDefinition.OnShipDeath.AddListener(enemiesManager.OnEmemyDeath); } if (weapons.Length != 0) { weapon = stats.GetDefaultWeapon(); SetWeaponTypeForAll(weapon); weaponReady = true; //bugFix: need to reactivate fire after reenable of object, but onEnable runs before Start ActivateFire(); } }
// Use this for initialization void Start() { enemyAnimationController = GetComponent <Animator>(); enemiesManager = FindObjectOfType <EnemiesManager>(); enemiesManager.AddMonster(); StartCoroutine(Fire()); }
void Start() { m_CurrentCheckPointIndex = 0; m_FailedToPassCheckPointSound = GetComponent <AudioSource>(); m_MainPlayerScript = m_Player.GetComponent <MainPlayerScript>(); m_EnemiesManagerScript = m_EnemiesManagerObject.GetComponent <EnemiesManager>(); }
protected virtual void Start() { player = GetLinkedObject("player_obj"); health = GetLinkedObject("health_obj").GetComponent <Hp>(); stamina = GetLinkedObject("stamina_obj").GetComponent <Stamina>(); stamina_img = stamina.GetComponent <CompImage>(); leftamina_img = GetLinkedObject("leftamina_bar").GetComponent <CompImage>(); mana = GetLinkedObject("mana_obj").GetComponent <Mana>(); mana_img = mana.GetComponent <CompImage>(); left_mana_img = GetLinkedObject("leftmana_bar").GetComponent <CompImage>(); audio = player.GetComponent <CompAudio>(); movement = player.GetComponent <MovementController>(); anim_controller = GetComponent <CompAnimation>(); damage_feedback = player.GetComponent <DamageFeedback>(); characters_manager = player.GetComponent <CharactersManager>(); enemy_manager = GetLinkedObject("player_enemies_manager").GetComponent <EnemiesManager>(); play_breathing_audio = false; currently_playing_b_audio = false; force_audio = false; }
public void Setup(GameManager gameManager, EnemiesManager enemiesManager, PlayerMovement playerMovement) { this.enemiesManager = enemiesManager; this.gameManager = gameManager; this.playerMovement = playerMovement; audioSource = GetComponent <AudioSource>(); StartCoroutine("Movement"); }
void Awake() { if (instance != null) { Debug.LogError("More than one EnemiesManager in scene !"); return; } instance = this; }
void Start() { enemiesManager = GameObject.FindObjectOfType <EnemiesManager>(); gameManager = GameObject.FindObjectOfType <GameManager>(); transform.Rotate(-90.0f, 0.0f, 0.0f, Space.Self); transform.position += new Vector3(0, 0, 0.254f); velBullet = new Vector3(0, speed, 0); }
private void Awake() { if (Instance != null) { Destroy(this.gameObject); } Instance = this; }
// Use this for initialization void Start() { nav = GetComponentInChildren <NavMeshAgent>(); EM = GetComponent <EnemiesManager>(); anim = GetComponent <Animator>(); HeadingPosition = EM.NavChanged(); nav.speed = 0; }
void Awake() { g_instance = this; m_spawnPrograms = new SpawnProgram[7]; m_enemiesKilledCount = new int[7]; Init(); }
private void Awake() { if (instance != null) { Debug.LogError("More than one enemy manager."); return; } instance = this; }
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>(); }
private void Start() { _enemiesManager = FindObjectOfType <EnemiesManager>(); _position = transform.position; StartCoroutine(Shoot()); SetParameters(towerInfo); }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); } else { instance = this; } }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
void Awake() { if (instance == null) { instance = this; } else { Debug.LogError("Duplicated ScoreManager, ingoring this one", gameObject); } }
private void CreateInstance() { if (Instance != null && Instance != this) { Destroy(gameObject); } else { Instance = this; } }
void OnContact() { CompCollider col = GetComponent <CompCollider>(); GameObject collided_obj = col.GetCollidedObject(); Vector3 point = col.GetContactPoint(); Vector3 normal = col.GetContactNormal(); // DAMAGE --- if (collided_obj != null && destroyed == false) { /* PLAY AUDIO */ GetComponent <CompAudio>().PlayEvent("TheonImpact"); //Lock transform to avoid trespassing more than one collider rb.LockTransform(); // Check the specific enemy in front of you and apply dmg or call object OnContact EnemiesManager enemy_manager = GetLinkedObject("player_enemies_manager").GetComponent <EnemiesManager>(); if (enemy_manager.IsEnemy(collided_obj)) { enemy_manager.ApplyDamage(collided_obj, damage, Enemy_BT.ENEMY_GET_DAMAGE_TYPE.ARROW); if (arrow_blood_particles != null) { arrow_blood_particles.GetComponent <Transform>().SetUpVector(normal); arrow_blood_particles.GetComponent <Transform>().SetPosition(point + normal * 2); CompParticleSystem arrow_particles_script = arrow_blood_particles.GetComponent <CompParticleSystem>(); arrow_particles_script.ActivateEmission(true); } } else { CompCollider obj_col = collided_obj.GetComponent <CompCollider>(); if (obj_col != null) { obj_col.CallOnContact(); } if (arrow_sparks_particles != null) { arrow_sparks_particles.GetComponent <Transform>().SetUpVector(normal); arrow_sparks_particles.GetComponent <Transform>().SetPosition(point + normal * 2); CompParticleSystem wall_particles_script = arrow_sparks_particles.GetComponent <CompParticleSystem>(); wall_particles_script.ActivateEmission(true); } } } if (destroyed == false) { Destroy(gameObject); destroyed = true; } }
public override void Start() { this.range = 2; current_map = GetLinkedObject("current_map"); if (current_map == null) { Debug.Log("Map GameObject in Enemy spear is NULL"); } rand = new System.Random(); mov = GetComponent <Movement_Action>(); if (mov == null) { Debug.Log("Script movement action in Enemy spear is NULL"); } GameObject Temp_go = GetLinkedObject("enemies_manager"); if (Temp_go == null) { Debug.Log("Gameobject enemies_manager not found"); } else { EnemiesManager enemy_manager = Temp_go.GetComponent <EnemiesManager>(); if (enemy_manager == null) { Debug.Log("EnemySpear_BT: enemies_manager is not detected"); } else { enemy_manager.AddLanceEnemy(gameObject); } } if (texture_type == 0) { enemy_mat_sword = GetMaterialByName("Alpha1_SpearEnemy_Material_21_04"); } else if (texture_type == 1) { enemy_mat_sword = GetMaterialByName("Alpha1_SpearEnemy2_Material_21_04"); } spear_name = GetLinkedObject("spear_name"); base.Start(); base.DeactivateHUD(spear_name); }
void Start() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(this); } Ticker.OnTickEvent += CheckSpawns; }
private void Awake() { if (Instance == null) { Instance = this; } else { GameObject.Destroy(this.gameObject); } timer = 0; EnemiesGroupList = new List <EnemiesGroup>(); }
public RainManager(MarcoPlayer player, EnemiesManager enemyManager) { this.player = player; this.enemyManager = enemyManager; stopwatch = new Stopwatch(); endComputing = new ManualResetEvent(true); waitForComputing = new AutoResetEvent(false); blockIfMainThreadFirst = new ManualResetEvent(false); startDrawing = new ManualResetEvent(false); waitForEndDrawing = new ManualResetEvent(false); buffor = new ManualResetEvent(false); }
// Use this for initialization void Start () { enemiesManager = GameObject.Find("EnemiesManager").GetComponent<EnemiesManager>(); if(enemiesManager!=null) { enemiesManager.OnEnemiesCountChanged += OnEnemiesChanged; } tankController = GameObject.FindGameObjectWithTag("Player").GetComponent<TankController>(); if(tankController!=null) { tankController.Health.OnHealthChanged += OnHealtChanged; tankController.Health.OnTankDestroyed += OnTankDestroyed; } }
void Awake () { if (instance == null) { instance = this; } DontDestroyOnLoad(this); mEnemies = new List<Enemy>(); Enemy[] casseCouilleDeUnity = FindObjectsOfType<Enemy>() as Enemy[]; for(int i = 0; i < casseCouilleDeUnity.Length; i++) { mEnemies.Add(casseCouilleDeUnity[i]); } }
void Start () { instanceEM = EnemiesManager.instance; }