Ejemplo n.º 1
0
    IEnumerator IE_unlock()
    {
        Transform trans_shadow       = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "Shadow").transform;
        Vector3   originScale_shadow = trans_shadow.localScale;

        const float duration = 1.8f;
        float       timer    = 0;

        while (timer < duration)
        {
            timer += Time.deltaTime;
            float t = timer / duration;

            trans_shadow.localScale = Vector3.Lerp(originScale_shadow, GameFunction.getVector3(1, 0, 1), t);
            SR_Stone_crack.color    = Color.Lerp(SR_Stone_crack.color, Color.black, t);

            yield return(null);
        }

        Stone_trans.GetComponent <Rigidbody2D>().isKinematic = false;
        this.enabled = false;
        this.GetComponent <BoxCollider2D>().enabled = false;

        //Destroy(this.gameObject);
    }
Ejemplo n.º 2
0
    public override void onStart()
    {
        base.onStart();

        animator.SetTrigger(currentState.ToString());
        Gravity            = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "Gravity").GetComponent <BoxCollider2D>();
        dashParticle       = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "DashDustParticle").GetComponent <ParticleSystem>().emission;
        originParticleRate = dashParticle.rate.constant;
        dashParticle.rate  = 0;

        if (transform.localScale.x < 0)  //向右
        {
            offset_Right = Gravity.bounds.min + Gravity.bounds.size.x * Vector3.right - transform.position + Vector3.one * 0.3f;
            GameFunction.t_Vector3.Set(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
            transform.localScale = GameFunction.t_Vector3;
            offset_Left          = Gravity.bounds.min - transform.position + new Vector3(-0.3f, 0.3f, 0);
            GameFunction.t_Vector3.Set(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
            transform.localScale = GameFunction.t_Vector3;
        }
        else
        {
            offset_Left = Gravity.bounds.min - transform.position + new Vector3(-0.3f, 0.3f, 0);
            GameFunction.t_Vector3.Set(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
            transform.localScale = GameFunction.t_Vector3;
            offset_Right         = Gravity.bounds.min + Gravity.bounds.size.x * Vector3.right - transform.position + Vector3.one * 0.3f;
            GameFunction.t_Vector3.Set(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
            transform.localScale = GameFunction.t_Vector3;
        }

        Dir = (transform.localScale.x < 0 ? dir.right : dir.left);
    }
Ejemplo n.º 3
0
    public override void onStart()
    {
        base.onStart();

        CollHeight = colliderID[0].bounds.extents.y * 2;
        leftPoint.transform.position = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "Gravity").GetComponent <BoxCollider2D>().bounds.min + new Vector3(Dir == dir.left ? -0.05f : 0.05f, 0.01f, 0);
    }
Ejemplo n.º 4
0
    override protected IEnumerator die()  //死亡
    {
        //销毁光晕
        try
        {
            Destroy(GameFunction.GetGameObjectInChildrenByName(this.gameObject, "Bloom"));
        }
        catch
        {
        }

        this.GetComponent <BoxCollider2D>().enabled = false;
        deadParticle.SetActive(true);
        GetComponent <SpriteRenderer>().enabled = false;
        this.enabled = false;

        Time.timeScale = 0;
        CameraFollow.instance.shakeCamera(0.25f, 0.04f, 0.2f); //镜头抖动
        yield return(new WaitForSecondsRealtime(0.1f));        //卡屏

        Time.timeScale = 1;
        yield return(new WaitForSeconds(deadParticle.GetComponent <ParticleSystem>().startLifetime));

        Destroy(this.gameObject);
    }
Ejemplo n.º 5
0
    void setElementBoxTrigger()
    {
        BoxCollider2D t  = GetComponent <BoxCollider2D>();
        BoxCollider2D t2 = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "Element").GetComponent <BoxCollider2D>();

        t2.offset = t.offset;
        t2.size   = t.size;
    }
Ejemplo n.º 6
0
    public override void onStart()
    {
        base.onStart();

        currentState           = monster_2_state.walk;
        CollHeight             = colliderID[0].bounds.extents.y * 2;
        eye.transform.position = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "Gravity").GetComponent <BoxCollider2D>().bounds.min + new Vector3(Dir == dir.left ? -0.05f : 0.05f, 0.01f, 0);
        viewDistance_player   *= Random.Range(0.6f, 1.4f); //每个单体看见玩家的距离不同
    }
Ejemplo n.º 7
0
    void Start()
    {
        bl_SR    = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "bl").GetComponent <SpriteRenderer>();
        coin_SR  = GetComponent <SpriteRenderer>();
        bloom_SR = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "bloom").GetComponent <SpriteRenderer>();
        Effect   = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "Effect");

        Effect.SetActive(false);
        randomOffset.z = -0.1f;
        originScale_bl = bl_SR.transform.localScale;
    }
Ejemplo n.º 8
0
    public override void onStart()
    {
        base.onStart();

        changeState(currentState);

        changeDir(dir.left);
        eye_Left = colliderID[0].bounds.min - transform.position + GameFunction.getVector3(-0.2f, 0.2f, 0);
        changeDir(dir.right);
        eye_Right     = colliderID[0].bounds.max + Vector3.down * colliderID[0].bounds.size.y - transform.position + GameFunction.getVector3(0.2f, 0.2f, 0);
        Attack_Effect = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "Attack_Effect");
    }
Ejemplo n.º 9
0
    IEnumerator IE_TipBox_Move(int i)
    {
        isAnimation_openGroove = true;

        currentSelectGemGrooveID = i;
        OpenNewGroove_MessageBox.SetActive(true);
        GameFunction.GetGameObjectInChildrenByName(OpenNewGroove_MessageBox, "Text").GetComponent <Text>().text = string.Format("是否消耗<color=red>{0}</color>个碎片开启新的宝石槽?", PerGrooveFragNum);

        if (GrooveMessageBox_select == null)
        {
            GrooveMessageBox_select = GameFunction.GetGameObjectInChildrenByName(OpenNewGroove_MessageBox, "Select");
        }

        GrooveMessageBox_select.SetActive(false);

        const float   first_animation_duration = 0.2f;
        RectTransform t_rect = OpenNewGroove_MessageBox.GetComponent <RectTransform>();
        {
            float _time0 = 0;
            while (_time0 < first_animation_duration)
            {
                _time0 += Time.deltaTime;
                float t = _time0 / first_animation_duration;
                t_rect.anchoredPosition = Vector3.Lerp(Vector3.left * 710, Vector3.zero, t);

                yield return(null);
            }
        }

        const float second_animation_duration = 0.3f;

        {
            float _time0 = 0;
            while (_time0 < second_animation_duration)
            {
                _time0 += Time.deltaTime;
                float t = _time0 / second_animation_duration;
                t_rect.anchoredPosition = Vector3.zero + Vector3.right * Mathf.Sin(Mathf.Lerp(0, 360, t) * Mathf.Deg2Rad) * Mathf.Lerp(50, 30, t);

                yield return(null);
            }
        }

        isAnimation_openGroove = false;
    }
Ejemplo n.º 10
0
 private void Start()
 {
     BoxColl = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "Collider").GetComponent <BoxCollider2D>();
 }
Ejemplo n.º 11
0
 private void Start()
 {
     Halo       = GameFunction.GetGameObjectInChildrenByName(this.gameObject, "Halo");
     SoulSprite = GameFunction.GetGameObjectInChildrenByName(Halo, "SoulSprite");
 }