Exemple #1
0
    private void ShowGreedBullet(Transform marisaTF)
    {
        if (marisaTF.rotation.eulerAngles.y != 0)
        {
            float      point_x        = marisaTF.position.x - 1.0f;
            float      point_y        = marisaTF.position.y;
            GameObject greedBullet_Up = GameObject.Instantiate(greed_Bullet);
            greedBullet_Up.transform.position = new Vector2(point_x, point_y);
            ZhiXianBullet greed_UpBullet = greedBullet_Up.GetComponent <ZhiXianBullet>();
            greed_UpBullet.targetVec = new Vector2(-3, Mathf.Sqrt(3)).normalized;


            GameObject greedBullet_Down = GameObject.Instantiate(greed_Bullet);
            greedBullet_Down.transform.position = new Vector2(point_x, point_y);
            ZhiXianBullet greed_DownBullet = greedBullet_Down.GetComponent <ZhiXianBullet>();
            greed_DownBullet.targetVec = new Vector2(-3, -Mathf.Sqrt(3)).normalized;
        }

        else
        {
            float      point_x        = marisaTF.position.x + 1.0f;
            float      point_y        = marisaTF.position.y;
            GameObject greedBullet_Up = GameObject.Instantiate(greed_Bullet);
            greedBullet_Up.transform.position = new Vector2(point_x, point_y);
            ZhiXianBullet greed_UpBullet = greedBullet_Up.GetComponent <ZhiXianBullet>();
            greed_UpBullet.targetVec = new Vector2(3, Mathf.Sqrt(3)).normalized;


            GameObject greedBullet_Down = GameObject.Instantiate(greed_Bullet);
            greedBullet_Down.transform.position = new Vector2(point_x, point_y);
            ZhiXianBullet greed_DownBullet = greedBullet_Down.GetComponent <ZhiXianBullet>();
            greed_DownBullet.targetVec = new Vector2(3, -Mathf.Sqrt(3)).normalized;
        }
    }
Exemple #2
0
    private void ShowRedBullet(Transform marisaTF)
    {
        if (marisaTF.transform.rotation.eulerAngles.y != 0)
        {
            float      point_x   = marisaTF.position.x + radius;
            float      point_y   = marisaTF.position.y;
            GameObject redBullet = GameObject.Instantiate(red_Bullet);
            red_Bullet.transform.position = new Vector2(point_x, point_y);
            ZhiXianBullet red_UpBullet = red_Bullet.GetComponent <ZhiXianBullet>();
            Vector2       red_target   = new Vector2(-3, Mathf.Sqrt(3));
            red_UpBullet.targetVec = red_target.normalized;

            GameObject redBullet_Down = GameObject.Instantiate(red_Bullet);
            redBullet_Down.transform.position = new Vector3(point_x, point_y);
            ZhiXianBullet red_DownBullet = redBullet_Down.GetComponent <ZhiXianBullet>();
            red_DownBullet.targetVec = new Vector2(-3, -Mathf.Sqrt(3)).normalized;
        }


        else
        {
            float      point_x   = marisaTF.position.x - radius;
            float      point_y   = marisaTF.position.y;
            GameObject redBullet = GameObject.Instantiate(red_Bullet);
            red_Bullet.transform.position = new Vector2(point_x, point_y);
            ZhiXianBullet red_UpBullet = red_Bullet.GetComponent <ZhiXianBullet>();
            Vector2       red_target   = new Vector2(3, Mathf.Sqrt(3));
            red_UpBullet.targetVec = red_target.normalized;

            GameObject redBullet_Down = GameObject.Instantiate(red_Bullet);
            redBullet_Down.transform.position = new Vector3(point_x, point_y);
            ZhiXianBullet red_DownBullet = redBullet_Down.GetComponent <ZhiXianBullet>();
            red_DownBullet.targetVec = new Vector2(3, -Mathf.Sqrt(3)).normalized;
        }
    }
Exemple #3
0
    private void ShowBlueBullet(Transform marisaTF)
    {
        if (marisaTF.rotation.eulerAngles.y != 0)
        {
            float      point_x       = (radius) * Mathf.Cos(165 * Mathf.Deg2Rad) + marisaTF.position.x;
            float      point_y       = (radius) * Mathf.Sin(165 * Mathf.Deg2Rad) + marisaTF.position.y;
            GameObject blueBullet_Up = GameObject.Instantiate(blue_Bullet);
            blueBullet_Up.transform.position = new Vector3(point_x, point_y);
            ZhiXianBullet blue_UpBullet = blueBullet_Up.GetComponent <ZhiXianBullet>();
            blue_UpBullet.targetVec = new Vector2(-1, 0).normalized;

            GameObject blueBullet_Down = GameObject.Instantiate(blue_Bullet);
            blueBullet_Down.transform.position = new Vector2(point_x, -point_y);
            ZhiXianBullet blue_DownBullet = blueBullet_Down.GetComponent <ZhiXianBullet>();
            blue_DownBullet.targetVec = new Vector2(-1, 0).normalized;
        }

        else
        {
            float      point_x       = (radius) * Mathf.Cos(165 * Mathf.Deg2Rad) + marisaTF.position.x;
            float      point_y       = (radius) * Mathf.Sin(165 * Mathf.Deg2Rad) + marisaTF.position.y;
            GameObject blueBullet_Up = GameObject.Instantiate(blue_Bullet);
            blueBullet_Up.transform.position = new Vector3(-point_x, point_y);
            ZhiXianBullet blue_UpBullet = blueBullet_Up.GetComponent <ZhiXianBullet>();
            blue_UpBullet.targetVec = new Vector2(1, 0).normalized;

            GameObject blueBullet_Down = GameObject.Instantiate(blue_Bullet);
            blueBullet_Down.transform.position = new Vector2(-point_x, -point_y);
            ZhiXianBullet blue_DownBullet = blueBullet_Down.GetComponent <ZhiXianBullet>();
            blue_DownBullet.targetVec = new Vector2(1, 0).normalized;
        }
    }
Exemple #4
0
    private void OnDestroy()
    {
        GameObject effectPrefab = ResourcesManager.Instance.LoadEffect("starBoom");
        GameObject bulletPrefab = ResourcesManager.Instance.LoadBullet("boom_small");

        GameObject effect = Instantiate(effectPrefab);

        effect.transform.position = transform.position;
        float angle = 0;

        for (int i = 0; i < 8; i++)
        {
            angle += 45;
            float      point_x  = (radius) * Mathf.Cos(angle * Mathf.Deg2Rad) + transform.position.x;
            float      point_y  = (radius) * Mathf.Sin(angle * Mathf.Deg2Rad) + transform.position.y;
            Vector2    pointVec = new Vector2(point_x, point_y);
            GameObject go       = GameObject.Instantiate(bulletPrefab);
            go.transform.position = pointVec;

            ZhiXianBullet buttle = go.GetComponent <ZhiXianBullet>();
            buttle.m_Type = BulletBase.BulletTpye.emptyBullet;

            buttle.targetVec = targetPos;
        }
    }
Exemple #5
0
    IEnumerator InstanteBullet()
    {
        for (int i = 0; i < 60; i++)
        {
            GameObject go  = Instantiate(bulletPrefab);
            Vector3    pos = new Vector3(radius * Mathf.Cos(angle * Mathf.Deg2Rad) + centerPoint.x, radius * Mathf.Sin(angle * Mathf.Deg2Rad) + centerPoint.y);
            transform.position    = new Vector3((radius - 0.1f) * Mathf.Cos(angle * Mathf.Deg2Rad) + centerPoint.x, (radius - 0.1f) * Mathf.Sin(angle * Mathf.Deg2Rad));
            go.transform.position = pos;
            ZhiXianBullet zhiXianBullet = go.GetComponent <ZhiXianBullet>();
            zhiXianBullet.targetVec = new Vector2(-radius * Mathf.Cos((angle - 30) * Mathf.Deg2Rad), -radius * Mathf.Sin((angle - 30) * Mathf.Deg2Rad));
            angle += 6;

            SpriteRenderer render = go.GetComponent <SpriteRenderer>();
            render.sprite = sprite;
            yield return(new WaitForSeconds(0.02f));
        }
        StartCoroutine(InstanteBullet());
    }
Exemple #6
0
    public void ShowSkill(Vector2 marisaVec)
    {
        angle = 0;
        for (int i = 0; i < 20; i++)
        {
            angle += 18.0f;
            float      point_x  = (radius) * Mathf.Cos(angle * Mathf.Deg2Rad) + marisaVec.x;
            float      point_y  = (radius) * Mathf.Sin(angle * Mathf.Deg2Rad) + marisaVec.y;
            Vector2    pointVec = new Vector2(point_x, point_y);
            GameObject go       = GameObject.Instantiate(bulletPrefab);
            go.transform.position = pointVec;
            Vector2       targetVec = new Vector2(radius * Mathf.Cos((angle + 30) * Mathf.Deg2Rad), radius * Mathf.Sin((angle + 30) * Mathf.Deg2Rad));
            ZhiXianBullet buttle    = go.GetComponent <ZhiXianBullet>();
            buttle.m_Type = BulletBase.BulletTpye.emptyBullet;

            buttle.targetVec = targetVec;
        }
    }