Exemplo n.º 1
0
    public void MoveCardIntoThisSlotImmediately(Card card, int position)
    {
        GameGuiSlot oldSlot = GameGui.Instance.GetSlotWithCard(card);
        if(oldSlot != null)
            oldSlot.RemoveCardFromSlot(card);

        if(!Cards.Contains(card))
            Cards.Add(card);
        card.transform.rotation = GetNextCardRotation(card.Side);
        card.transform.position = GetCardPosition(position);

        card.transform.parent = transform;

        if(IsCementarySlot)
            card.Reinitialize();
    }
Exemplo n.º 2
0
    public void MoveCardIntoThisSlot(Card card, int position, ST.UnitFunction function, float avarageVelocity, ActionDelegate onFinish)
    {
        Transform oldParent = card.transform.parent;
        card.transform.parent = null;
        Vector3 oldPosition = card.transform.position;
        Quaternion oldRotation = card.transform.rotation;
        card.transform.parent = oldParent;

        MoveCardIntoThisSlotImmediately(card, position);
        card.transform.parent = null;
        Vector3 targetPosition = card.transform.position;
        Quaternion targetRotation = card.transform.rotation;

        card.transform.position = oldPosition;
        card.transform.rotation = oldRotation;

        float time = (targetPosition-card.transform.position).magnitude/avarageVelocity;

        ST.LinearPositionTransformParam positionTransform = new ST.LinearPositionTransformParam(targetPosition, time, false, function);
        TransformManager.Instance.AddTransform(card.gameObject, delegate(int id, GameObject obj, ITransform transform, TransformEventType t)
        {
            if(t == TransformEventType.OnListFinished)
            {
                card.transform.parent = gameObject.transform;
                if(IsCementarySlot)
                    card.Reinitialize();
                if(onFinish != null)
                    onFinish();
            }
        }, positionTransform);

        ST.LinearRotationTransformParam rotationTransform = new ST.LinearRotationTransformParam(targetRotation, 0.92f*time, false, function);
        TransformManager.Instance.AddTransform(card.gameObject, rotationTransform);
    }