예제 #1
0
    public Switcher SetUp(Hexagon hexagon, bool upper)
    {
        target  = hexagon;
        isUpper = upper;
        this.transform.parent           = hexagon.transform.parent;
        this.transform.localPosition    = isUpper ? hexagon.upPosition + Vector3.down * .1f : hexagon.lowPosition + Vector3.up * .1f;
        this.transform.localScale       = new Vector3(1f, 1f, 1f);
        this.transform.localPosition   += Vector3.forward;
        this.transform.localEulerAngles = isUpper ? Vector3.zero : new Vector3(0, 0, 180f);

        Random();
        UpdateColor();
        if (fadeAway != null)
        {
            fadeAway.Cancel();
        }
        if (fadeIn != null)
        {
            fadeIn.Cancel();
        }

        fadeIn = new FadeIn();
        fadeIn.Init(this.gameObject, .3f, null);

        return(this);
    }
예제 #2
0
    public Rock SetUp(Hexagon hexagon, bool isUpper)
    {
        if (fadeAway != null)
        {
            fadeAway.Cancel();
        }
        if (fadeIn != null)
        {
            fadeIn.Cancel();
        }

        this.transform.parent        = hexagon.transform.parent;
        this.transform.localPosition = isUpper ? hexagon.upPosition: hexagon.lowPosition;
        SpriteRenderer spriteRender   = this.gameObject.GetComponent <SpriteRenderer>();
        float          originalLength = spriteRender.sprite.bounds.extents.x * 2f;

        float scale = hexagon.length / originalLength;

        this.transform.localScale       = new Vector3(scale, scale, scale);
        this.transform.localPosition   += Vector3.forward;
        this.transform.localEulerAngles = isUpper ? Vector3.zero : new Vector3(0, 0, 180f);
        fadeIn = new FadeIn();
        fadeIn.Init(this.gameObject, .3f, null);

        return(this);
    }
예제 #3
0
    public void SetUp(Piece s, Piece e)
    {
        start = s;
        end   = e;
        this.transform.parent = start.transform.parent;
        float angle = 0;

        if (start.isUpper)
        {
            if (end.x < start.x)
            {
                angle = 60;
            }
            else if (end.y > start.y)
            {
                angle = 120;
            }
            else
            {
                angle = 0;
            }
        }
        else
        {
            if (end.x > start.x)
            {
                angle = 60;
            }
            else if (end.y < start.y)
            {
                angle = 120;
            }
            else
            {
                angle = 0;
            }
        }

        if (fadeIn != null)
        {
            fadeIn.Cancel();
        }


        Vector3 rotation = new Vector3(0, 0, angle);

        this.transform.localPosition  = (start.transform.localPosition + end.transform.localPosition) * .5f;
        this.transform.localPosition -= Vector3.forward;

        this.transform.localEulerAngles = rotation;
        fadeIn = new FadeIn();
        fadeIn.Init(this.gameObject, .3f, null);
    }
예제 #4
0
 private void ResetBlock()
 {
     while (fadeAways.Count > 0)
     {
         FadeAway fadeAway = fadeAways[0];
         fadeAway.Cancel();
         fadeAways.RemoveAt(0);
     }
     while (fadeIns.Count > 0)
     {
         FadeIn fadeIn = fadeIns[0];
         fadeIn.Cancel();
         fadeIns.RemoveAt(0);
     }
     fadeAways.Clear();
     fadeIns.Clear();
     up_left.GetComponent <SpriteRenderer> ().color    = defaultColor;
     up_right.GetComponent <SpriteRenderer> ().color   = defaultColor;
     up_down.GetComponent <SpriteRenderer> ().color    = defaultColor;
     down_left.GetComponent <SpriteRenderer> ().color  = defaultColor;
     down_right.GetComponent <SpriteRenderer> ().color = defaultColor;
     down_up.GetComponent <SpriteRenderer> ().color    = defaultColor;
 }
예제 #5
0
    public Maze SetUp(Hexagon hexagon, bool isUpper)
    {
        if (fadeAway != null)
        {
            fadeAway.Cancel();
        }
        this.transform.parent           = hexagon.transform.parent;
        this.transform.localPosition    = isUpper ? hexagon.upPosition : hexagon.lowPosition;
        this.transform.localScale       = new Vector3(.85f, .85f, 1f);
        this.transform.localPosition   += Vector3.forward;
        this.transform.localEulerAngles = isUpper ? Vector3.zero : new Vector3(0, 0, 180f);
        render.color = new Color32(255, 255, 255, 255);
        life.Reset();
        if (fadeIn != null)
        {
            fadeIn.Cancel();
        }

        fadeIn = new FadeIn();
        fadeIn.Init(this.gameObject, .3f, null);


        return(this);
    }