예제 #1
0
파일: Die.cs 프로젝트: quill18/LD46-quill18
    public void OnEndDrag(PointerEventData eventData)
    {
        // Check if we're on a valid DieSlot, if not return to our old DieSlot

        List <RaycastResult> results = new List <RaycastResult>();

        graphicRaycaster.Raycast(eventData, results);

        foreach (RaycastResult result in results)
        {
            DieSlot ds = result.gameObject.GetComponentInParent <DieSlot>();
            if (ds != null)
            {
                // We're in a DieSlot!
                //Debug.Log("Hit!");
                if (IsLegalForSlot(ds))
                {
                    AttachToSlot(ds);
                    return;
                }
            }
        }

        // If we get here, we weren't dropped on a slot. Re-attach to the old spot.
        //Debug.Log("Missed!");
        AttachToSlot(originalDieSlot);
        StatBlock.alpha = 1;
    }
예제 #2
0
    public void MoveToSetDieArea()
    {
        GameState gs = GameState.GetCurrentGameState();

        DieSlot ds = gs.GetNextSetDieSlot();

        MoveToSlot(ds);
    }
예제 #3
0
 //	take me out of whatever slot I'm in right now
 void Unslot()
 {
     if (mySlot)
     {
         mySlot.removeChild(this.gameObject);
         mySlot = null;
     }
 }
예제 #4
0
    //  scale the die back to normal size. Hide the die.
    public void MoveToDiceCupArea()
    {
        DieSlot ds = GameState.GetCurrentGameState().diceCupSlot;

        MoveToSlot(ds);
        //Unslot();
        //Rigidbody rb = this.GetComponent<Rigidbody>();
        //rb.detectCollisions = false;
    }
예제 #5
0
    //	put this die into the locked area
    public void MoveToLockedArea()
    {
        GameState gs = GameState.GetCurrentGameState();

        DieSlot ds = gs.GetNextLockedDieSlot();

        MoveToSlot(ds);
        GameState.LockedDieThisTurn();
    }
예제 #6
0
파일: Die.cs 프로젝트: quill18/LD46-quill18
    void AttachToSlot(DieSlot ds)
    {
        dieSlot.SetDie(null);

        dieSlot = ds;
        dieSlot.SetDie(this);

        this.transform.SetParent(dieSlot.transform);
        this.transform.localPosition = Vector3.zero;
    }
예제 #7
0
    public void MoveToUnlockedArea()
    {
        if (this.isInLockedArea())
        {
            GameState.UnlockedDieThisTurn();
        }
        GameState gs = GameState.GetCurrentGameState();

        DieSlot ds = gs.GetNextActiveDieSlot();

        MoveToSlot(ds);
    }
예제 #8
0
    void MoveToSlot(DieSlot ds)
    {
        Unslot();
        this.onMoveCompleteUnslot = ds.onMoveCompleteUnslot;    //  this die does whatever the dieSlot wants to do

        ds.addChild(this.gameObject);
        mySlot = ds;

        //Rigidbody rb = this.GetComponent<Rigidbody>();
        //rb.detectCollisions = false;
        //rb.constraints = RigidbodyConstraints.FreezeAll;
    }
예제 #9
0
파일: Die.cs 프로젝트: quill18/LD46-quill18
    bool IsLegalForSlot(DieSlot ds)
    {
        if (ds.CanOccupy(this) == false)
        {
            return(false);
        }

        // Make sure we are legal for this slot!
        if (ds.QuestDiceSlot.TargetType == QuestDeck.TARGET_TYPE.EXACT && GetValue() != ds.QuestDiceSlot.TargetPipValue)
        {
            return(false);
        }
        if (ds.QuestDiceSlot.TargetType == QuestDeck.TARGET_TYPE.MIN && GetValue() < ds.QuestDiceSlot.TargetPipValue)
        {
            return(false);
        }
        if (ds.QuestDiceSlot.TargetType == QuestDeck.TARGET_TYPE.MAX && GetValue() > ds.QuestDiceSlot.TargetPipValue)
        {
            return(false);
        }

        return(true);
    }