示例#1
0
    void Start()
    {
        inHale = transform.GetChild(5).gameObject;
        inHale.gameObject.SetActive(false);
        particle   = transform.GetChild(4).gameObject.GetComponent <ParticleSystem>();
        bossVisual = transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>();
        waterStagemanagerScript = GameObject.Find("WaterStageManager").GetComponent <WaterStageManager>();
        waterBossAnimator       = transform.GetChild(0).GetComponent <Animator>();
        col                  = GetComponent <Collider2D>();
        rayCastEnd           = transform.GetChild(1);
        rayCastStart         = transform.GetChild(2);
        player               = GameObject.Find("Player");
        rb                   = GetComponent <Rigidbody2D>();
        corners              = new List <Transform>();
        inhaleScript         = inHale.GetComponent <inhale>();
        playerMovementScript = GameObject.Find("Player").GetComponent <PlayerMovement>();
        tempLast             = 0;

        StartCoroutine(AI());

        for (int i = 0; i < GameObject.Find("RandomCorners").transform.childCount; i++)
        {
            corners.Add(GameObject.Find("RandomCorners").transform.GetChild(i));
        }
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        playerMovementScript = GameObject.Find("Player").GetComponent <PlayerMovement>();

        if (SceneManager.GetActiveScene().name == PHASE1)
        {
            cols = GameObject.Find("Cols");
        }
        else if (SceneManager.GetActiveScene().name == PHASE2_3)
        {
            inhaleScript = GameObject.Find("WaterBoss").transform.GetChild(5).GetComponent <inhale>();
            GameObject.Find("WaterBoss").transform.GetChild(5).gameObject.SetActive(false);
            waterBossAiScript = GameObject.Find("WaterBoss").GetComponent <WaterBossAI>();

            //RandomIndex for toCorner WaterBossState
            for (int i = 0; i < randomAmount; i++)
            {
                do
                {
                    numberInsert = Random.Range(0, waterBossAiScript.corners.Count);
                } while (numberInsert == temp);

                temp = numberInsert;
                randomIndex.Add(numberInsert);
            }
        }
    }