示例#1
0
    static private void DestroyCellInLine(int x, int y, TypeLineBonus typeLine)
    {
        Field field = BonusManager.GetField();

        switch (typeLine)
        {
        case TypeLineBonus.Horizontal:
        {
            for (int i = 0; i < Field.size; i++)
            {
                field.cells[i, y].DestroyCrystal();
            }
            break;
        }

        case TypeLineBonus.Verical:
        {
            for (int i = 0; i < Field.size; i++)
            {
                field.cells[x, i].DestroyCrystal();
            }
            break;
        }
        }
    }
示例#2
0
 public void Move(TypeLineBonus type)
 {
     transform.localPosition = new Vector3(0, -0.5f, 0);
     spriteRenderer          = GetComponent <SpriteRenderer>();
     typeLineBonus           = type;
     MoveForwardUp();
 }
示例#3
0
    public void MoveToSlot(Slot slotToMove)
    {
        directionOfMove = TypeLineBonus.Verical;

        if (slot.x == slotToMove.x)
        {
            directionOfMove = TypeLineBonus.Verical;
        }
        if (slot.y == slotToMove.y)
        {
            directionOfMove = TypeLineBonus.Horizontal;
        }

        if (slot != null)
        {
            slot.planet = null;
        }
        slot = null;
        slotToMove.planet = this;
        transform.DOMove(slotToMove.transform.position, speedMove).SetEase(Ease.Linear).OnUpdate(
            delegate
        {
            if (slot != null)
            {
                SlotController.CanPlanetMove = false;
            }
        }).OnComplete(() => OnCompliteMove(slotToMove));
    }
示例#4
0
    static public void DestroyCell(int x, int y, TypeLineBonus typeLine)
    {
        Field      field = BonusManager.GetField();
        GameObject lizer = (GameObject)Instantiate(BonusManager.GetLizerPrefab(), field.cells[x, y].transform.position, field.cells[x, y].transform.rotation);
        float      speed = 0.7f;

        switch (typeLine)
        {
        case TypeLineBonus.Horizontal:
        {
            for (int i = 0; i < Field.size; i++)
            {
                lizer.transform.localEulerAngles = Vector3.zero;
            }

            if (Field.size / 2 > x)
            {
                speed = Mathf.Abs((x - Field.size / 2) + 1);
            }
            else
            {
                speed = (x - Field.size / 2);
            }
            speed = 0.7f - speed / 10;
            break;
        }

        case TypeLineBonus.Verical:
        {
            for (int i = 0; i < Field.size; i++)
            {
                lizer.transform.localEulerAngles = new Vector3(0, 0, 90);
            }

            if (Field.size / 2 > y)
            {
                speed = Mathf.Abs((y - Field.size / 2) + 1);
            }
            else
            {
                speed = (y - Field.size / 2);
            }
            speed = 0.7f - speed / 10;
            break;
        }
        }

        lizer.transform.DOScale(new Vector3(10, 0.1f, 1), speed / 1.5f).OnComplete(delegate { DestroyCellInLine(x, y, typeLine); Destroy(lizer); });
    }
示例#5
0
    public void MoveToSlot(Slot slotToMove, Planet exPlanet)
    {
        directionOfMove = TypeLineBonus.Verical;

        if (slot.x == slotToMove.x)
        {
            directionOfMove = TypeLineBonus.Verical;
        }
        if (slot.y == slotToMove.y)
        {
            directionOfMove = TypeLineBonus.Horizontal;
        }

        if (slot != null)
        {
            slot.planet = null;
        }
        slot = null;
        slotToMove.planet = this;
        transform.DOMove(slotToMove.transform.position, speedMove).SetEase(Ease.Linear).OnUpdate(
            delegate
        {
            if (slot != null)
            {
                SlotController.CanPlanetMove = false;
            }
        }).OnComplete(delegate
        {
            if (HaveStarBonus())
            {
                typeOfPlanet = exPlanet.typeOfPlanet;
                if (exPlanet.CountBonus() != 0)
                {
                    typeOfExPlanetBonus = exPlanet.bonuses[0];
                }
            }
            OnCompliteMove(slotToMove);
        });
    }
示例#6
0
 public void Line(TypeLineBonus _type, Field _field, Crystal _crystal)
 {
     type    = _type;
     field   = _field;
     crystal = _crystal;
 }
示例#7
0
 public void SetDirectionOfMove(TypeLineBonus typeDir)
 {
     directionOfMove = typeDir;
 }