Esempio n. 1
0
    private void Start()
    {
        Vector3 initialBoatPosition = (onLeftBank) ? leftBankPosition : rightBankPosition;

        transform.position = initialBoatPosition;

        boatDropzone = GetComponent <Dropzone>();

        UpdateNextPosition();
    }
Esempio n. 2
0
 public void DropAt(Dropzone dropzone)
 {
     if (_currentItem != null)
     {
         _currentItem.OnDrop();
         dropzone.DropItem(_currentItem);
         RaiseEvent(new CarryableItemDroppedEvent(_currentItem));
         _currentItem = null;
     }
 }
Esempio n. 3
0
    private void OnMouseDown()
    {
        Dropzone previousDropzone = transform.parent.GetComponent <Dropzone>();

        if (canInteract && dropzone != null)
        {
            dropzone.AddItem(gameObject);
            dropzone = previousDropzone;
        }
    }
Esempio n. 4
0
    public void NetworkExecuteDiscard(int UID)
    {
        Dropzone            Dropzone  = (Dropzone)this.GetComponent("Dropzone");
        TournementControler Controler = tournamentControler;
        Hand THand = Controler.hands[Controler.turn];

        Controler.Discard.cards.Add(Instantiate(THand.cards[UID]));
        Destroy(THand.transform.GetChild(UID).gameObject);
        THand.cards.RemoveAt(UID);
        Controler.ifDisplay.setText(Controler.UpdateInfo(0));
    }
Esempio n. 5
0
    private void BoatBankToggleHandler()
    {
        Vector3Int boatState    = new Vector3Int(0, 0, 1);
        Dropzone   nextDropzone = (boat.onLeftBank) ? leftBank : rightBank;

        int childCount = boat.transform.childCount;
        List <Interactable> children = new List <Interactable>();

        for (int i = 0; i < childCount; i++)
        {
            Interactable interactable = boat.transform.GetChild(i).GetComponent <Interactable>();

            if (interactable.interactableType == Interactable.InteractableType.Missionary)
            {
                boatState += new Vector3Int(1, 0, 0);
            }
            else if (interactable.interactableType == Interactable.InteractableType.Cannibal)
            {
                boatState += new Vector3Int(0, 1, 0);
            }

            children.Add(interactable);
        }

        for (int i = 0; i < children.Count; i++)
        {
            nextDropzone.AddItem(children[i].gameObject);
            children[i].dropzone = boat.GetComponent <Dropzone>();
        }

        if (boat.onLeftBank)
        {
            currentState = currentState.AddState(boatState);
        }
        else
        {
            currentState = currentState.SubtractState(boatState);
        }

        bool isValid = currentState.IsValid(initalState);

        Debug.Log("Current State: " + currentState.ToString() + " isValid: " + isValid.ToString());

        if (!isValid)
        {
            Dropzone killzone = (currentState.x < currentState.y) ? leftBank : rightBank;
            KillMissonaries(killzone);
            ShowGameOver(isValid);
        }
        else if (currentState == goalState)
        {
            ShowGameOver(isValid);
        }
    }
Esempio n. 6
0
        private void OnTriggerExit(Collider other)
        {
            //Log.Debug("Magnet.OnTriggerExit: " + other.gameObject.name);
            Dropzone dropzone = other.gameObject.GetComponent <Dropzone>();

            if (dropzone != null && carriedCrate != null)
            {
                carriedCrate.isInDropzone = false;
                scene.CratesInDropzone--;
            }
        }
Esempio n. 7
0
    public int GetUniqueID(Dragable dObject, Card tempCardScript, Dropzone tempDropZone, Controler Tcontrol)
    {
        //dObject.returnParent.gameObject.GetComponent<Hand>().cards.Remove(tempCardScript);
        dObject.returnParent = this.transform;
        tempDropZone.AddCard(tempCardScript);
        Hand THand = Tcontrol.hands[Tcontrol.turn];
        int  UID   = GetCard(THand, tempCardScript);

        Remove(tempCardScript, THand);
        Tcontrol.ifDisplay.setText(Tcontrol.UpdateInfo(0));
        return(UID);
    }
Esempio n. 8
0
    public void PlayCard(int UID, TournementControler Tc)
    {
        Dropzone Dropzone = Tc.dzones[playerID];
        Hand     THand    = Tc.hands[Tc.turn];

        HandleTextFile.WriteLog("AI Log: Player " + (playerID + 1) + " Plays Card" + THand.cards[UID].name, GameControler.SName);
        Card temp = Instantiate(THand.cards[UID]);

        Dropzone.AddCard(temp);
        temp.transform.SetParent(Dropzone.transform);
        Destroy(THand.transform.GetChild(UID).gameObject);
    }
Esempio n. 9
0
    public void NetworkExecuteDropTZone(int UID)
    {
        Debug.Log(UID);
        Dropzone            Dropzone  = (Dropzone)this.GetComponent("Dropzone");
        TournementControler Controler = tournamentControler;
        Hand THand = Controler.hands[Controler.turn];
        Card temp  = Instantiate(THand.cards[UID]);

        Dropzone.AddCard(temp);
        temp.transform.SetParent(this.transform);
        Destroy(THand.transform.GetChild(UID).gameObject);
        THand.cards.RemoveAt(UID);
        Controler.ifDisplay.setText(Controler.UpdateInfo(0));
    }
Esempio n. 10
0
    void Start()
    {
        r = GetComponent <SpriteRenderer>();
        c = GetComponent <BoxCollider2D>();

        if (trigger)
        {
            dropzone = trigger.GetComponent <Dropzone>();
        }
        else
        {
            dropzone = null;
        }
    }
Esempio n. 11
0
    void OnDragStop()
    {
        // try to find a dropzone who can accept this drop
        Dropzone newTargetDropzone = null;

        foreach (Dropzone dropzone in dropZones)
        {
            if (dropzone.CanDrop(_collider))
            {
                newTargetDropzone = dropzone;
                break;
            }
        }

        if (newTargetDropzone != null)
        {
            // tell our old dropzone, if any, to lift
            if (targetDropzone)
            {
                targetDropzone.Lift();
            }

            targetDropzone = newTargetDropzone;

            // accept drop and if cb returns true, auto move
            if (OnDropAccepted(this))
            {
                MoveToTarget.Go(
                    gameObject,
                    targetDropzone.transform.position,
                    autoMoveArrivalThreshold

                    ).OnArrival = (_) => FinishDrop();
            }
        }
        else
        {
            // reject drop and if cb returns true, auto move home
            if (OnDropRejected(this))
            {
                MoveToTarget.Go(
                    gameObject,
                    _dragging.OriginalPos,
                    autoMoveArrivalThreshold

                    ).OnArrival = (_) => FinishReturn();
            }
        }
    }
Esempio n. 12
0
 private void KillMissonaries(Dropzone killzone)
 {
     for (int i = 0; i < killzone.transform.childCount; i++)
     {
         Transform    item         = killzone.transform.GetChild(i);
         Interactable interactable = item.GetComponent <Interactable>();
         if (interactable.interactableType == Interactable.InteractableType.Missionary)
         {
             item.GetComponent <Animator>().SetBool(Animator.StringToHash("isDead"), true);
         }
         else if (interactable.interactableType == Interactable.InteractableType.Cannibal)
         {
             item.GetComponent <Animator>().SetBool(Animator.StringToHash("shouldAttack"), true);
         }
     }
 }
Esempio n. 13
0
    // Use this for initialization
    void Start()
    {
        cube = GameObject.CreatePrimitive(PrimitiveType.Cube);

        if (cube == null)
            throw new UnityException("Could not create primitive");

        drop = (Dropzone)cube.AddComponent(typeof(Dropzone));

        if (drop == null)
            throw new MissingComponentException("Dropzone component not found");

        drop.Jumper = jumper;
        cube.layer = 8;
        cube.transform.localScale = this.transform.lossyScale + new Vector3(0.0f, 5.0f, 0.0f);
        cube.transform.position = this.transform.position + new Vector3(0.0f, cube.transform.localScale.y / 2.0f, 0.0f);
    }
Esempio n. 14
0
 public void FlipDropzone(Dropzone d, bool faceUp)
 {
     if (faceUp)
     {
         foreach (Transform child in d.transform)
         {
             child.gameObject.GetComponent <Image>().sprite = child.gameObject.GetComponent <AdventureCard>().cardBack;
         }
     }
     else
     {
         foreach (Transform child in d.transform)
         {
             child.gameObject.GetComponent <Image>().sprite = child.gameObject.GetComponent <AdventureCard>().img;
         }
     }
 }
Esempio n. 15
0
        private void OnTriggerEnter(Collider other)
        {
            // we need the deployment barrier because the rope is not long enough for the magnet to reach the ground
            //Log.Debug("Magnet.OnTriggerEnter: " + other.gameObject.name);
            DeploymentBarrier barrier  = other.gameObject.GetComponent <DeploymentBarrier>();
            Dropzone          dropzone = other.gameObject.GetComponent <Dropzone>();

            if (barrier != null && carriedCrate == null)
            {
                movement.UnscaledVelocity = Vector3.up;
                OnCraneDeploymentReturning?.Invoke(scene.Game, new CraneEventArgs());
            }

            else if (dropzone != null && carriedCrate != null)
            {
                carriedCrate.isInDropzone = true;
                scene.CratesInDropzone++;
            }
        }
Esempio n. 16
0
 public void PlayCard(int UID, QuestController Qc, bool Sponsor, int Stage)
 {
     Debug.Log("StageNumber: " + Stage);
     if (!Sponsor)
     {
         Dropzone Dropzone = Qc.dzones[playerID];
         Hand     THand    = Qc.hands[Qc.turn];
         HandleTextFile.WriteLog("AI Log: Player " + (playerID + 1) + " Plays Card" + THand.cards[UID].name, GameControler.SName);
         Card temp = Instantiate(THand.cards[UID]);
         Dropzone.AddCard(temp);
         temp.transform.SetParent(Dropzone.transform);
         Destroy(THand.transform.GetChild(UID).gameObject);
     }
     else
     {
         Dropzone Dropzone = Qc.qzones[Stage];
         Hand     THand    = Qc.hands[Qc.turn];
         HandleTextFile.WriteLog("AI Log: Player " + (playerID + 1) + " Plays Card" + THand.cards[UID].name, GameControler.SName);
         Card temp = Instantiate(THand.cards[UID]);
         Dropzone.AddCard(temp);
         temp.transform.SetParent(Dropzone.transform);
         Destroy(THand.transform.GetChild(UID).gameObject);
     }
 }
Esempio n. 17
0
 public DefaultState(Dropzone <TItem> dropzone) : base(dropzone)
 {
 }
Esempio n. 18
0
        public static void Initialize(ApplicationDbContext context)
        {
            context.Database.EnsureCreated();
            if (context.PagePosts.Any())
            {
                return;
            }
            var PagePosts = new PagePost[]
            {
                new PagePost
                {
                    Title = "Pierwszy post na portalu",
                    Text  = "Witam wszystkich zebranych",
                    Date  = new DateTime(2018, 1, 10, 10, 20, 20)
                },
                new PagePost
                {
                    Title = "Drugi post na portalu",
                    Text  = "Witam wszystkich zebranych",
                    Date  = new DateTime(2018, 1, 12, 10, 20, 20)
                },
                new PagePost
                {
                    Title = "Trzeci post na portalu",
                    Text  = "No siema",
                    Date  = new DateTime(2018, 1, 16, 10, 20, 20)
                },
                new PagePost
                {
                    Title = "Czwarty post na portalu",
                    Text  = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse sodales nulla nisi, sit amet efficitur nisl tristique non. Donec ut dui faucibus nulla aliquam pulvinar vel in turpis. Proin malesuada malesuada tincidunt. Phasellus molestie erat nec arcu blandit mollis. Cras vitae nisl rutrum, tempor mauris at, suscipit libero. Nulla fermentum diam at purus imperdiet, nec efficitur massa imperdiet. Sed posuere ligula porttitor nibh tempus posuere. Nulla molestie dignissim lorem, vel semper enim aliquet nec. Donec convallis tellus ac venenatis tempor. Nulla vitae tellus cursus, feugiat nisl eget, bibendum quam. /n Etiam elementum hendrerit massa a consequat. Vestibulum iaculis sem quis turpis pharetra, eget ultrices elit maximus. Mauris ultricies, dui non bibendum consequat, urna est eleifend est, fringilla venenatis nunc lorem sed turpis. Vestibulum fermentum auctor justo, non pulvinar massa. Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed a neque interdum, cursus lacus eu, luctus velit. Suspendisse lectus ante, consequat et sollicitudin ac, pretium vitae nunc. Duis finibus erat in risus ullamcorper, ut facilisis enim convallis. Phasellus sodales lorem neque, ac efficitur ipsum tempor porta. Aenean sed lacinia ipsum, fermentum sodales nisl. Sed a libero et nunc finibus semper at ac enim. Nulla finibus nisl in arcu porttitor fringilla. Quisque fringilla purus at lectus egestas, id pharetra nisl interdum.",
                    Date  = new DateTime(2018, 1, 20, 20, 20, 20)
                }
            };

            foreach (PagePost pp in PagePosts)
            {
                context.PagePosts.Add(pp);
            }

            var countries = new Country[]
            {
                new Country
                {
                    name = "Poland"
                }
            };

            foreach (Country c in countries)
            {
                context.Countries.Add(c);
            }

            var regions = new Region[]
            {
                new Region
                {
                    Name    = "Mazowieckie",
                    Country = countries[0]
                },
                new Region
                {
                    Name    = "Warmińsko-mazurskie",
                    Country = countries[0]
                }
            };

            foreach (Region r in regions)
            {
                context.Regions.Add(r);
            }

            var dropzones = new Dropzone[]
            {
                new Dropzone
                {
                    Name    = "SkyDive Warszawa",
                    Region  = regions[0],
                    Address = "05-190 Nasielsk, Lotnisko Chrcynno"
                },
                new Dropzone
                {
                    Name    = "Strefa Baltic",
                    Region  = regions[1],
                    Address = "82-300 Elbląg, ul. Lotnicza 8b"
                }
            };

            foreach (Dropzone d in dropzones)
            {
                var roles = new ApplicationRole[]
                {
                    new ApplicationRole
                    {
                        Dropzone = d,
                        Name     = Role.Admin
                    },
                    new ApplicationRole
                    {
                        Dropzone = d,
                        Name     = Role.Moderator
                    }
                };
                foreach (ApplicationRole ar in roles)
                {
                    context.ApplicationRoles.Add(ar);
                }
                context.Dropzones.Add(d);
            }

            var role = new ApplicationRole()
            {
                Name = Role.Master
            };

            context.ApplicationRoles.Add(role);

            context.SaveChanges();
        }
Esempio n. 19
0
    public string getZoneType()
    {
        Dropzone tempScript = (Dropzone)this.GetComponent("Dropzone");

        return(tempScript.Type);
    }
Esempio n. 20
0
 private void UpdateNextPosition()
 {
     nextPosition = (onLeftBank) ? rightBankPosition : leftBankPosition;
     boatDropzone = (onLeftBank) ? leftBankDropzone : rightBankDropzone;
 }
Esempio n. 21
0
    //##3
    public void OnDrop(PointerEventData eventData)
    {
        Dragable dObject = eventData.pointerDrag.GetComponent <Dragable>();

        HandleTextFile.WriteLog("UI Log: Dragable Object Selected", GameControler.SName);
        //Debug.Log("*** DROP HAPPENED");
        if (dObject != null)
        {
            //Debug.Log("***" + this);
            HandleTextFile.WriteLog("UI Log: Dragable Object Not Null", GameControler.SName);
            if (this.GetComponent("Dropzone") != null)
            {
                HandleTextFile.WriteLog("UI Log: Valid Dropzone", GameControler.SName);
                //Debug.Log("***" + this);
                string ZType          = getZoneType();
                Card   tempCardScript = getCardType(dObject);
                if (tempCardScript != null)
                {
                    HandleTextFile.WriteLog("UI Log: Card " + tempCardScript.name + " Is Selected", GameControler.SName);
                    HandleTextFile.WriteLog("UI Log: Dropzone Type " + ZType, GameControler.SName);
                    switch (ZType)
                    {
                    case "TZone":
                        for (int i = 0; i < 3; i++)
                        {
                            int TypeCheck = 0;
                            if (TzoneTypes[i] == tempCardScript.Type)
                            {
                                Dropzone tempDropZoneScriptTzone = (Dropzone)this.GetComponent("Dropzone");
                                if (tempCardScript.Type == TzoneTypes[1])
                                {
                                    foreach (EquipmentCard e in tempDropZoneScriptTzone.Equipment)
                                    {
                                        if (e.TypeOfEquipment == ((EquipmentCard)tempCardScript).TypeOfEquipment)
                                        {
                                            TypeCheck++;
                                            HandleTextFile.WriteLog("UI Log: Equipmebt Type Already Present " + ((EquipmentCard)tempCardScript).TypeOfEquipment, GameControler.SName);
                                        }
                                    }
                                }
                                if (TypeCheck == 0)
                                {
                                    int UID = GetUniqueID(dObject, tempCardScript, tempDropZoneScriptTzone, tournamentControler);
                                    this.gameObject.GetComponent <PhotonView>().RPC("NetworkExecuteDropTZone", PhotonTargets.Others, UID);
                                }
                            }
                        }
                        HandleTextFile.WriteLog("UI Log: Card Droped", GameControler.SName);
                        break;

                    case "QZone":
                        for (int i = 0; i < 2; i++)
                        {
                            int TypeCheck = 0;
                            if (QzoneTypes[i] == tempCardScript.Type)
                            {
                                Dropzone tempDropZoneScriptQzone = (Dropzone)this.GetComponent("Dropzone");
                                if (tempCardScript.Type == QzoneTypes[1])
                                {
                                    foreach (EquipmentCard e in tempDropZoneScriptQzone.Equipment)
                                    {
                                        if (e.TypeOfEquipment == ((EquipmentCard)tempCardScript).TypeOfEquipment)
                                        {
                                            TypeCheck++;
                                            HandleTextFile.WriteLog("UI Log: Equipmebt Type Already Present " + ((EquipmentCard)tempCardScript).TypeOfEquipment, GameControler.SName);
                                        }
                                    }
                                }
                                else if (tempCardScript.Type == QzoneTypes[0])
                                {
                                    if (tempDropZoneScriptQzone.ControledFoes.Count > 0)
                                    {
                                        TypeCheck++;
                                    }
                                }
                                if (TypeCheck == 0)
                                {
                                    int UID = GetUniqueID(dObject, tempCardScript, tempDropZoneScriptQzone, questControler);
                                    this.gameObject.GetComponent <PhotonView>().RPC("NetworkExecuteDropQuests", PhotonTargets.Others, UID);
                                }
                            }
                        }
                        HandleTextFile.WriteLog("UI Log: Card Droped", GameControler.SName);
                        break;

                    case "PlayerQZone":
                        for (int i = 0; i < 3; i++)
                        {
                            int TypeCheck = 0;
                            if (PlayerQzoneTypes[i] == tempCardScript.Type)
                            {
                                Dropzone tempDropZoneScriptQzone = (Dropzone)this.GetComponent("Dropzone");
                                if (tempCardScript.Type == TzoneTypes[1])
                                {
                                    foreach (EquipmentCard e in tempDropZoneScriptQzone.Equipment)
                                    {
                                        if (e.TypeOfEquipment == ((EquipmentCard)tempCardScript).TypeOfEquipment)
                                        {
                                            TypeCheck++;
                                            HandleTextFile.WriteLog("UI Log: Equipmebt Type Already Present " + ((EquipmentCard)tempCardScript).TypeOfEquipment, GameControler.SName);
                                        }
                                    }
                                }
                                if (tempCardScript.Type == TzoneTypes[2] && tempDropZoneScriptQzone.SpecificUseCards.Count > 0)
                                {
                                    TypeCheck++;
                                    HandleTextFile.WriteLog("UI Log: Amour Type Already Present", GameControler.SName);
                                }
                                if (TypeCheck == 0)
                                {
                                    int UID = GetUniqueID(dObject, tempCardScript, tempDropZoneScriptQzone, questControler);
                                    this.gameObject.GetComponent <PhotonView>().RPC("NetworkExecuteDropQuests", PhotonTargets.Others, UID);
                                }
                            }
                        }
                        HandleTextFile.WriteLog("UI Log: Card Droped", GameControler.SName);
                        break;

                    case "Discard":
                        Debug.Log("i Love Debugs They make me happy");
                        HandleTextFile.WriteLog("Action Log: Discard Card " + tempCardScript.name, GameControler.SName);
                        Dropzone  tempDropZoneScriptDiscard = (Dropzone)this.GetComponent <Dropzone>();
                        Controler temp;
                        if (tournamentControler.gameState == true)
                        {
                            temp = tournamentControler;
                        }
                        else
                        {
                            temp = questControler;
                        }
                        dObject.returnParent = this.transform;
                        dObject.transform.SetParent(this.transform);
                        Card TempCard = tempCardScript;
                        Hand THand2   = temp.hands[temp.turn];
                        int  UID2     = GetCard(THand2, tempCardScript);
                        Remove(tempCardScript, THand2);
                        temp.Discard.cards.Add(TempCard);
                        dObject.gameObject.GetComponent <Image>().sprite = dObject.gameObject.GetComponent <AdventureCard>().cardBack;
                        this.gameObject.GetComponent <PhotonView>().RPC("NetworkExecuteDiscard", PhotonTargets.Others, UID2);
                        temp.ifDisplay.setText(temp.UpdateInfo(0));
                        break;



                    default:
                        Debug.Log("ERROR WILL ROBINSON");
                        break;
                    }
                }
            }
            else
            {
                dObject.returnParent = this.transform;
            }
        }
    }