Inheritance: MonoBehaviour
 private void OnDestroy()
 {
     if (this == Instance)
     {
         Instance = null;
     }
 }
Example #2
0
    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
    }
Example #3
0
    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>();
    }
Example #4
0
 public void Setup(EnemiesManager enemiesManager, GameManager gameManager)
 {
     this.enemiesManager = enemiesManager;
     this.gameManager    = gameManager;
     audioSource         = GetComponent <AudioSource>();
     renderer            = GetComponent <Renderer>();
 }
Example #5
0
 private void Start()
 {
     shootPause  = Random.Range(attackPause - 2, attackPause + 2); // pause after shoot
     attackTimer = shootPause / 2;
     rb          = GetComponent <Rigidbody>();
     EnemiesManager.increaseEnemyCounter();
 }
Example #6
0
    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);
    }
Example #7
0
    // 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();
        }
    }
Example #10
0
 // Use this for initialization
 void Start()
 {
     enemyAnimationController = GetComponent <Animator>();
     enemiesManager           = FindObjectOfType <EnemiesManager>();
     enemiesManager.AddMonster();
     StartCoroutine(Fire());
 }
Example #11
0
 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;
    }
Example #13
0
 public void Setup(GameManager gameManager, EnemiesManager enemiesManager, PlayerMovement playerMovement)
 {
     this.enemiesManager = enemiesManager;
     this.gameManager    = gameManager;
     this.playerMovement = playerMovement;
     audioSource         = GetComponent <AudioSource>();
     StartCoroutine("Movement");
 }
Example #14
0
 void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("More than one EnemiesManager in scene !"); return;
     }
     instance = this;
 }
Example #15
0
 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;
 }
Example #17
0
 // Use this for initialization
 void Start()
 {
     nav             = GetComponentInChildren <NavMeshAgent>();
     EM              = GetComponent <EnemiesManager>();
     anim            = GetComponent <Animator>();
     HeadingPosition = EM.NavChanged();
     nav.speed       = 0;
 }
Example #18
0
	void Awake()
	{
		g_instance = this;
		
		m_spawnPrograms = new SpawnProgram[7];
		m_enemiesKilledCount = new int[7];
		
		Init();
	}
Example #19
0
 private void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("More than one enemy manager.");
         return;
     }
     instance = this;
 }
Example #20
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>();
 }
Example #21
0
    void Awake()
    {
        g_instance = this;

        m_spawnPrograms      = new SpawnProgram[7];
        m_enemiesKilledCount = new int[7];

        Init();
    }
Example #22
0
        private void Start()
        {
            _enemiesManager = FindObjectOfType <EnemiesManager>();

            _position = transform.position;

            StartCoroutine(Shoot());

            SetParameters(towerInfo);
        }
Example #23
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
Example #24
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #25
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Example #26
0
 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;
     }
 }
Example #28
0
    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;
        }
    }
Example #29
0
    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);
    }
Example #30
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(this);
        }

        Ticker.OnTickEvent += CheckSpawns;
    }
Example #31
0
 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);
        }
Example #33
0
	// 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;
        }
	}
Example #34
0
	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]);
        }
    }
Example #35
0
 void Start ()
 {
     instanceEM = EnemiesManager.instance;
 }