Ejemplo n.º 1
0
    // Use this for initialization
    void OnEnable()
    {
        Enemycontroller = GameObject.Find("GameController").GetComponent <EnemyManager>();
        maincontroller  = GameObject.Find("GameController").GetComponent <MainController>();
        scorescript     = GameObject.Find("Canvas").transform.Find("ScoreText").GetComponent <ScoreText_Animation>();
        player          = GameObject.FindGameObjectWithTag("Player").gameObject;
        playerscript    = player.GetComponent <PlayerScript>();
        AudioEnemyDeath = GameObject.Find("Audio").transform.Find("Enemydeath").GetComponent <AudioSource>();

        rensabool = false;
        mutekicnt = 0;
        _HitMax   = 1f + Mathf.Floor(Enemycontroller.EnemyHpRank);

        if (Mathf.Floor(Enemycontroller.EnemyHpRank) <= 1)
        {
            rankspeed = 1f;
        }
        else
        {
            rankspeed = Mathf.Floor(Enemycontroller.EnemyHpRank);
        }


        if (this.gameObject.tag == "Enemy/Mid")
        {
            _Hitpoint = _HitMax + 10f;
        }
        else
        {
            _Hitpoint = _HitMax;
        }

        shotcnt = 0;

        move = Enemycontroller._movetype1;

        if (this.gameObject.tag == "Enemy/Type2")
        {
            movespeed = 1f;
        }

        if (this.gameObject.tag == "Enemy/Mid")
        {
            movespeed = 0.5f;
        }
    }
    void Awake()
    {
        maincontroller  = GameObject.Find("GameController").GetComponent <MainController>();
        enemycontroller = GameObject.FindGameObjectWithTag("GameManeger").GetComponent <EnemyManager>();
        corelife        = GameObject.FindGameObjectWithTag("Core").GetComponent <CoreScript>();
        lifeui          = GameObject.Find("Canvas").transform.Find("PlayerHealth").GetComponent <lifeUI>();
        scorescript     = GameObject.Find("Canvas").transform.Find("ScoreText").GetComponent <ScoreText_Animation>();
        DamegeEffectObj = GameObject.FindGameObjectWithTag("Effect/Player").gameObject;
        DamegeEffect    = DamegeEffectObj.GetComponent <ParticleSystem>();
        BomEffect       = GameObject.FindGameObjectWithTag("Effect/Bom").GetComponent <ParticleSystem>();

        playerrender = GetComponent <SpriteRenderer>();

        AudioPlayerShot  = GameObject.Find("Audio").transform.Find("Playershot").GetComponent <AudioSource>();
        Audiopower_up    = GameObject.Find("Audio").transform.Find("power_up").GetComponent <AudioSource>();
        AudioCorekaifuku = GameObject.Find("Audio").transform.Find("Corekaifuku").GetComponent <AudioSource>();
        AudioOptionSpawn = GameObject.Find("Audio").transform.Find("OptionSpawn").GetComponent <AudioSource>();
        AudioDamage      = GameObject.Find("Audio").transform.Find("damage").GetComponent <AudioSource>();
    }