Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     booster = GetComponent<Booster>();
     neutral = GetComponent<Neutral>();
     Now = State.Neutral;
     frameNow = Time.frameCount;
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     moveState = GetComponent<MoveState>();
     booster = GetComponent<Booster>();
     neutral = GetComponent<Neutral>();
     rigidbody = GetComponent<Rigidbody>();
     rigidbody.velocity = Vector3.forward * 1.0f;
 }
Exemplo n.º 3
0
        public Booster GenerateBooster(BoosterSet set)
        {
            this.set = set;
            Booster newBooster = new Booster();

            for(int i = 0; i < bulk; i++)
            {
                newBooster.Contents.Add(GenerateCard());
            }
            newBooster.Contents.Add(GenerateRareCard());

            return newBooster;
        }
Exemplo n.º 4
0
    public bool applyBooster(Booster.Model model)
    {
        if (hasBooster(model))
            return false;

        switch (model)
        {
            case Booster.Model.QueenTermite:
                int adds = termites * Costants.QUEEN_TERMITE_THRESHOLD;
                if (adds < Costants.QUEEN_TERMITE_THRESHOLD)
                    adds = Costants.QUEEN_TERMITE_THRESHOLD;
                termites += adds;
                return true;
        }
        boosters.Add(Booster.initFromModel(model));
        updateIndicators();
        return true;
    }
Exemplo n.º 5
0
    //Step 4 modify purchasing
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        if (String.Equals(args.purchasedProduct.definition.id, removeAds, StringComparison.Ordinal))
        {
            // Debug.Log("Adds Removed - restart game");
            //bannerAds.HideBannerAdd();
            LoadInfo.adsRemoved = true;
            LoadInfo.SaveNonConsumable(LoadInfo.adsRemoved, "removeAds");
        }

        else if (String.Equals(args.purchasedProduct.definition.id, gamePack1, StringComparison.Ordinal))
        {
            //Debug.Log("Game Pack 1");
            ++LoadInfo.booster1No;
            ++LoadInfo.booster4No;
            ++LoadInfo.booster5No;
            LoadInfo.Save(LoadInfo.booster1No, "onePieceRemove");
            LoadInfo.Save(LoadInfo.booster4No, "switch");
            LoadInfo.Save(LoadInfo.booster5No, "meteor");
            GameObject booster1;
            GameObject booster3;
            GameObject booster4;

            booster1 = GameObject.FindGameObjectWithTag("GB1");
            booster3 = GameObject.FindGameObjectWithTag("GB3");
            booster4 = GameObject.FindGameObjectWithTag("GB4");

            if (booster1 != null && booster3 != null && booster4 != null)
            {
                Booster b1 = booster1.GetComponent <Booster>();
                Booster b3 = booster3.GetComponent <Booster>();
                Booster b4 = booster4.GetComponent <Booster>();
                if (b1 != null && b3 != null && b4 != null)
                {
                    //Debug.Log("my Debug");
                    b1.UpdateGameBoosters();
                    b3.UpdateGameBoosters();
                    b4.UpdateGameBoosters();
                }
            }
        }

        else if (String.Equals(args.purchasedProduct.definition.id, pregamePack1, StringComparison.Ordinal))
        {
            //Debug.Log("Pregame Pack 1");
            ++LoadInfo.booster3No;
            ++LoadInfo.booster6No;
            ++LoadInfo.booster7No;
            LoadInfo.Save(LoadInfo.booster3No, "colorBomb");
            LoadInfo.Save(LoadInfo.booster6No, "jumping");
            LoadInfo.Save(LoadInfo.booster7No, "big");
            GameObject window;

            window = GameObject.FindGameObjectWithTag("messageWindow");

            if (window != null)
            {
                MessageWindow message = window.GetComponent <MessageWindow>();

                if (message != null)
                {
                    message.UpdatePreGameBoosters();
                }
            }
        }

        else if (String.Equals(args.purchasedProduct.definition.id, allBoostersPack1, StringComparison.Ordinal))
        {
            //Debug.Log("All Boosters Pack 1");
            ++LoadInfo.booster1No;
            ++LoadInfo.booster3No;
            ++LoadInfo.booster4No;
            ++LoadInfo.booster5No;
            ++LoadInfo.booster6No;
            ++LoadInfo.booster7No;
            LoadInfo.Save(LoadInfo.booster1No, "onePieceRemove");
            LoadInfo.Save(LoadInfo.booster3No, "colorBomb");
            LoadInfo.Save(LoadInfo.booster4No, "switch");
            LoadInfo.Save(LoadInfo.booster5No, "meteor");
            LoadInfo.Save(LoadInfo.booster6No, "jumping");
            LoadInfo.Save(LoadInfo.booster7No, "big");
            GameObject booster1;
            GameObject booster3;
            GameObject booster4;

            booster1 = GameObject.FindGameObjectWithTag("GB1");
            booster3 = GameObject.FindGameObjectWithTag("GB3");
            booster4 = GameObject.FindGameObjectWithTag("GB4");

            if (booster1 != null && booster3 != null && booster4 != null)
            {
                Booster b1 = booster1.GetComponent <Booster>();
                Booster b3 = booster3.GetComponent <Booster>();
                Booster b4 = booster4.GetComponent <Booster>();
                if (b1 != null && b3 != null && b4 != null)
                {
                    b1.UpdateGameBoosters();
                    b3.UpdateGameBoosters();
                    b4.UpdateGameBoosters();
                }
            }
            GameObject window;

            window = GameObject.FindGameObjectWithTag("messageWindow");

            if (window != null)
            {
                MessageWindow message = window.GetComponent <MessageWindow>();

                if (message != null)
                {
                    message.UpdatePreGameBoosters();
                }
            }
        }

        else if (String.Equals(args.purchasedProduct.definition.id, gamePack3, StringComparison.Ordinal))
        {
            //Debug.Log("Game Pack 3");
            LoadInfo.booster1No = LoadInfo.booster1No + 3;
            LoadInfo.booster4No = LoadInfo.booster4No + 3;
            LoadInfo.booster5No = LoadInfo.booster5No + 3;
            LoadInfo.Save(LoadInfo.booster1No, "onePieceRemove");
            LoadInfo.Save(LoadInfo.booster4No, "switch");
            LoadInfo.Save(LoadInfo.booster5No, "meteor");
            GameObject booster1;
            GameObject booster3;
            GameObject booster4;
            booster1 = GameObject.FindGameObjectWithTag("GB1");
            booster3 = GameObject.FindGameObjectWithTag("GB3");
            booster4 = GameObject.FindGameObjectWithTag("GB4");

            if (booster1 != null && booster3 != null && booster4 != null)
            {
                Booster b1 = booster1.GetComponent <Booster>();
                Booster b3 = booster3.GetComponent <Booster>();
                Booster b4 = booster4.GetComponent <Booster>();
                if (b1 != null && b3 != null && b4 != null)
                {
                    b1.UpdateGameBoosters();
                    b3.UpdateGameBoosters();
                    b4.UpdateGameBoosters();
                }
            }
        }

        else if (String.Equals(args.purchasedProduct.definition.id, pregamePack3, StringComparison.Ordinal))
        {
            //Debug.Log("Pregame Pack 3");
            LoadInfo.booster3No = LoadInfo.booster3No + 3;
            LoadInfo.booster6No = LoadInfo.booster6No + 3;
            LoadInfo.booster7No = LoadInfo.booster7No + 3;
            LoadInfo.Save(LoadInfo.booster3No, "colorBomb");
            LoadInfo.Save(LoadInfo.booster6No, "jumping");
            LoadInfo.Save(LoadInfo.booster7No, "big");
            GameObject window;

            window = GameObject.FindGameObjectWithTag("messageWindow");

            if (window != null)
            {
                MessageWindow message = window.GetComponent <MessageWindow>();

                if (message != null)
                {
                    message.UpdatePreGameBoosters();
                }
            }
        }

        else if (String.Equals(args.purchasedProduct.definition.id, allBoostersPack3, StringComparison.Ordinal))
        {
            //Debug.Log("All Boosters Pack 3");
            LoadInfo.booster1No = LoadInfo.booster1No + 3;
            LoadInfo.booster3No = LoadInfo.booster3No + 3;
            LoadInfo.booster4No = LoadInfo.booster4No + 3;
            LoadInfo.booster5No = LoadInfo.booster5No + 3;
            LoadInfo.booster6No = LoadInfo.booster6No + 3;
            LoadInfo.booster7No = LoadInfo.booster7No + 3;
            LoadInfo.Save(LoadInfo.booster1No, "onePieceRemove");
            LoadInfo.Save(LoadInfo.booster3No, "colorBomb");
            LoadInfo.Save(LoadInfo.booster4No, "switch");
            LoadInfo.Save(LoadInfo.booster5No, "meteor");
            LoadInfo.Save(LoadInfo.booster6No, "jumping");
            LoadInfo.Save(LoadInfo.booster7No, "big");
            GameObject booster1;
            GameObject booster3;
            GameObject booster4;
            booster1 = GameObject.FindGameObjectWithTag("GB1");
            booster3 = GameObject.FindGameObjectWithTag("GB3");
            booster4 = GameObject.FindGameObjectWithTag("GB4");

            if (booster1 != null && booster3 != null && booster4 != null)
            {
                Booster b1 = booster1.GetComponent <Booster>();
                Booster b3 = booster3.GetComponent <Booster>();
                Booster b4 = booster4.GetComponent <Booster>();
                if (b1 != null && b3 != null && b4 != null)
                {
                    b1.UpdateGameBoosters();
                    b3.UpdateGameBoosters();
                    b4.UpdateGameBoosters();
                }
            }
            GameObject window;

            window = GameObject.FindGameObjectWithTag("messageWindow");

            if (window != null)
            {
                MessageWindow message = window.GetComponent <MessageWindow>();

                if (message != null)
                {
                    message.UpdatePreGameBoosters();
                }
            }
        }

        else if (String.Equals(args.purchasedProduct.definition.id, gamePack5, StringComparison.Ordinal))
        {
            //Debug.Log("Game Pack 5");
            LoadInfo.booster1No = LoadInfo.booster1No + 5;
            LoadInfo.booster4No = LoadInfo.booster4No + 5;
            LoadInfo.booster5No = LoadInfo.booster5No + 5;
            LoadInfo.Save(LoadInfo.booster1No, "onePieceRemove");
            LoadInfo.Save(LoadInfo.booster4No, "switch");
            LoadInfo.Save(LoadInfo.booster5No, "meteor");
            GameObject booster1;
            GameObject booster3;
            GameObject booster4;
            booster1 = GameObject.FindGameObjectWithTag("GB1");
            booster3 = GameObject.FindGameObjectWithTag("GB3");
            booster4 = GameObject.FindGameObjectWithTag("GB4");

            if (booster1 != null && booster3 != null && booster4 != null)
            {
                Booster b1 = booster1.GetComponent <Booster>();
                Booster b3 = booster3.GetComponent <Booster>();
                Booster b4 = booster4.GetComponent <Booster>();
                if (b1 != null && b3 != null && b4 != null)
                {
                    b1.UpdateGameBoosters();
                    b3.UpdateGameBoosters();
                    b4.UpdateGameBoosters();
                }
            }
        }

        else if (String.Equals(args.purchasedProduct.definition.id, pregamePack5, StringComparison.Ordinal))
        {
            //Debug.Log("Pregame Pack 5");
            LoadInfo.booster3No = LoadInfo.booster3No + 5;
            LoadInfo.booster6No = LoadInfo.booster6No + 5;
            LoadInfo.booster7No = LoadInfo.booster7No + 5;
            LoadInfo.Save(LoadInfo.booster3No, "colorBomb");
            LoadInfo.Save(LoadInfo.booster6No, "jumping");
            LoadInfo.Save(LoadInfo.booster7No, "big");
            GameObject window;

            window = GameObject.FindGameObjectWithTag("messageWindow");

            if (window != null)
            {
                MessageWindow message = window.GetComponent <MessageWindow>();

                if (message != null)
                {
                    message.UpdatePreGameBoosters();
                }
            }
        }

        else if (String.Equals(args.purchasedProduct.definition.id, allBoostersPack5, StringComparison.Ordinal))
        {
            //Debug.Log("All Boosters Pack 5");
            LoadInfo.booster1No = LoadInfo.booster1No + 5;
            LoadInfo.booster3No = LoadInfo.booster3No + 5;
            LoadInfo.booster4No = LoadInfo.booster4No + 5;
            LoadInfo.booster5No = LoadInfo.booster5No + 5;
            LoadInfo.booster6No = LoadInfo.booster6No + 5;
            LoadInfo.booster7No = LoadInfo.booster7No + 5;
            LoadInfo.Save(LoadInfo.booster1No, "onePieceRemove");
            LoadInfo.Save(LoadInfo.booster3No, "colorBomb");
            LoadInfo.Save(LoadInfo.booster4No, "switch");
            LoadInfo.Save(LoadInfo.booster5No, "meteor");
            LoadInfo.Save(LoadInfo.booster6No, "jumping");
            LoadInfo.Save(LoadInfo.booster7No, "big");
            GameObject booster1;
            GameObject booster3;
            GameObject booster4;
            booster1 = GameObject.FindGameObjectWithTag("GB1");
            booster3 = GameObject.FindGameObjectWithTag("GB3");
            booster4 = GameObject.FindGameObjectWithTag("GB4");

            if (booster1 != null && booster3 != null && booster4 != null)
            {
                Booster b1 = booster1.GetComponent <Booster>();
                Booster b3 = booster3.GetComponent <Booster>();
                Booster b4 = booster4.GetComponent <Booster>();
                if (b1 != null && b3 != null && b4 != null)
                {
                    b1.UpdateGameBoosters();
                    b3.UpdateGameBoosters();
                    b4.UpdateGameBoosters();
                }
            }
            GameObject window;

            window = GameObject.FindGameObjectWithTag("messageWindow");

            if (window != null)
            {
                MessageWindow message = window.GetComponent <MessageWindow>();

                if (message != null)
                {
                    message.UpdatePreGameBoosters();
                }
            }
        }

        else if (String.Equals(args.purchasedProduct.definition.id, gamePack15, StringComparison.Ordinal))
        {
            //Debug.Log("Game Pack 15");
            LoadInfo.booster1No = LoadInfo.booster1No + 15;
            LoadInfo.booster4No = LoadInfo.booster4No + 15;
            LoadInfo.booster5No = LoadInfo.booster5No + 15;
            LoadInfo.Save(LoadInfo.booster1No, "onePieceRemove");
            LoadInfo.Save(LoadInfo.booster4No, "switch");
            LoadInfo.Save(LoadInfo.booster5No, "meteor");
            GameObject booster1;
            GameObject booster3;
            GameObject booster4;
            booster1 = GameObject.FindGameObjectWithTag("GB1");
            booster3 = GameObject.FindGameObjectWithTag("GB3");
            booster4 = GameObject.FindGameObjectWithTag("GB4");

            if (booster1 != null && booster3 != null && booster4 != null)
            {
                Booster b1 = booster1.GetComponent <Booster>();
                Booster b3 = booster3.GetComponent <Booster>();
                Booster b4 = booster4.GetComponent <Booster>();
                if (b1 != null && b3 != null && b4 != null)
                {
                    b1.UpdateGameBoosters();
                    b3.UpdateGameBoosters();
                    b4.UpdateGameBoosters();
                }
            }
        }

        else if (String.Equals(args.purchasedProduct.definition.id, pregamePack15, StringComparison.Ordinal))
        {
            //Debug.Log("Pregame Pack 15");
            LoadInfo.booster3No = LoadInfo.booster3No + 15;
            LoadInfo.booster6No = LoadInfo.booster6No + 15;
            LoadInfo.booster7No = LoadInfo.booster7No + 15;
            LoadInfo.Save(LoadInfo.booster3No, "colorBomb");
            LoadInfo.Save(LoadInfo.booster6No, "jumping");
            LoadInfo.Save(LoadInfo.booster7No, "big");
            GameObject window;

            window = GameObject.FindGameObjectWithTag("messageWindow");

            if (window != null)
            {
                MessageWindow message = window.GetComponent <MessageWindow>();

                if (message != null)
                {
                    message.UpdatePreGameBoosters();
                }
            }
        }

        else if (String.Equals(args.purchasedProduct.definition.id, allBoostersPack15, StringComparison.Ordinal))
        {
            //Debug.Log("All Boosters Pack 15");
            LoadInfo.booster1No = LoadInfo.booster1No + 15;
            LoadInfo.booster3No = LoadInfo.booster3No + 15;
            LoadInfo.booster4No = LoadInfo.booster4No + 15;
            LoadInfo.booster5No = LoadInfo.booster5No + 15;
            LoadInfo.booster6No = LoadInfo.booster6No + 15;
            LoadInfo.booster7No = LoadInfo.booster7No + 15;
            LoadInfo.Save(LoadInfo.booster1No, "onePieceRemove");
            LoadInfo.Save(LoadInfo.booster3No, "colorBomb");
            LoadInfo.Save(LoadInfo.booster4No, "switch");
            LoadInfo.Save(LoadInfo.booster5No, "meteor");
            LoadInfo.Save(LoadInfo.booster6No, "jumping");
            LoadInfo.Save(LoadInfo.booster7No, "big");
            GameObject booster1;
            GameObject booster3;
            GameObject booster4;
            booster1 = GameObject.FindGameObjectWithTag("GB1");
            booster3 = GameObject.FindGameObjectWithTag("GB3");
            booster4 = GameObject.FindGameObjectWithTag("GB4");

            if (booster1 != null && booster3 != null && booster4 != null)
            {
                Booster b1 = booster1.GetComponent <Booster>();
                Booster b3 = booster3.GetComponent <Booster>();
                Booster b4 = booster4.GetComponent <Booster>();
                if (b1 != null && b3 != null && b4 != null)
                {
                    b1.UpdateGameBoosters();
                    b3.UpdateGameBoosters();
                    b4.UpdateGameBoosters();
                }
            }
            GameObject window;

            window = GameObject.FindGameObjectWithTag("messageWindow");

            if (window != null)
            {
                MessageWindow message = window.GetComponent <MessageWindow>();

                if (message != null)
                {
                    message.UpdatePreGameBoosters();
                }
            }
        }

        else
        {
            //Debug.Log("Purchase Failed");
        }
        return(PurchaseProcessingResult.Complete);
    }
Exemplo n.º 6
0
    private ChestRewards GenerateBoosterRewards(ChestGenerationSettings chest, List <Tank> newTanks = null)
    {
        ChestRewards   chestRewards          = new ChestRewards();
        int            num                   = chest.boosterCardCount.Random();
        List <Booster> boostersForOwnedTanks = PlayerDataManager.GetBoostersForOwnedTanks();

        if (newTanks != null && newTanks.Count > 0)
        {
            foreach (Tank newTank in newTanks)
            {
                boostersForOwnedTanks.AddRange(PlayerDataManager.GetTankBoosters(newTank));
            }
        }
        boostersForOwnedTanks.Shuffle();
        for (int i = 0; i != num; i++)
        {
            if (i > boostersForOwnedTanks.Count || boostersForOwnedTanks.Count == 0)
            {
                chestRewards.coins += GetRandomBooster().coinValue;
                continue;
            }
            Booster booster = boostersForOwnedTanks.Random();
            if (UnityEngine.Random.value < chest.newBoosterCardProbability)
            {
                if (boostersForOwnedTanks.Count > 0)
                {
                    foreach (Booster item in boostersForOwnedTanks)
                    {
                        if (item.Count <= 0)
                        {
                            booster = item;
                            boostersForOwnedTanks.Remove(item);
                            break;
                        }
                    }
                }
            }
            else
            {
                List <Booster> list = new List <Booster>();
                foreach (Booster item2 in boostersForOwnedTanks)
                {
                    if (item2.Count > 0)
                    {
                        list.Add(item2);
                    }
                }
                if (list.Count > 0)
                {
                    booster = list.Random();
                }
            }
            boostersForOwnedTanks.Remove(booster);
            int  stackSize = chest.boosterStackSize.Random();
            Card card      = booster.CreateCards(stackSize);
            card.isNew = (booster.Count == 0);
            bool flag = false;
            for (int j = 0; j != chestRewards.cards.Count; j++)
            {
                if (chestRewards.cards[j].id.Equals(card.id))
                {
                    chestRewards.cards[j].count += card.count;
                    flag = true;
                }
            }
            if (!flag)
            {
                chestRewards.cards.Add(card);
            }
        }
        return(chestRewards);
    }
Exemplo n.º 7
0
 private void UsedBooster(Booster booster)
 {
     _scoreMultiplier += booster.Value;
 }
Exemplo n.º 8
0
 public void usedBooster(Booster.Model model)
 {
     availableBoostersIcons[(int)model - 1].text = (Int32.Parse(availableBoostersIcons[(int)model - 1].text) - 1) + "";
 }
    // methods //


    // method: determine the (boolean) state of this Dependency Requisite //
    public override bool state()
    {
        return(Booster.leftHandIsBoosting());
    }
    // methods //


    // method: determine the (boolean) state of this Dependency Requisite //
    public override bool state()
    {
        return(Booster.rightHandIsBoostingShallowly());
    }
Exemplo n.º 11
0
    // method: calculate the distance of the booster to the nearest recognized (according to Terrain Response) terrain in the direction of the booster's boosting; this also tracks for Booster Antidiminisher whether the booster is at distance to an antidiminishor //
    public static float distanceToTerrain(Booster booster)
    {
        // connect to the diminisher for the given booster //
        BoosterDiminisher diminisher = diminisherFor(booster);

        // determine any solid colliders that this diminisher's hand is currently inside of (according to Hand Insideness Tracking) //
        HashSet <GameObject> allCollidedObjects = (booster.leftInstance ? HandInsidenessTracking.allCollidedObjectsForLeftHand() : HandInsidenessTracking.allCollidedObjectsForRightHand());

        // if this diminisher's hand is currently inside of any solid collider objects: //
        if (allCollidedObjects.Count > 0)
        {
            // if any of the objects this diminisher's hand is inside of is on a recognized terrain layer: calculate the distance to the nearest recognized terrain to be 0 //
            foreach (GameObject collidedObject in allCollidedObjects)
            {
                if (TerrainResponse.recognizedTypedTerrainLayerIndex(diminisher.recognizedTerrainType, collidedObject.layer))
                {
                    diminisher.terrainDistancingLastFoundObstruction = false;                                   // track that obstruction was not found for this terrain distancing
                    return(0f);
                }
            }
            // otherwise: track that an obstruction was found for this terrain distancing, and consider the distance to terrain to be -1, as a flag of no recognized terrain being found //
            diminisher.terrainDistancingLastFoundObstruction = true;
            return(-1f);
        }
        // otherwise: determine the distance to the nearest recognized terrain via raycasting //
        else
        {
            // track that obstruction was not found for this terrain distancing //
            diminisher.terrainDistancingLastFoundObstruction = false;


            // determine the relativity transform that this booster's relativizer is using currently //
            Transform relativityTransform = BoosterRelativizer.relativityTransform(booster);


            // if there is a recognized terrain below, calculate distance based on that //

            RaycastHit[] raycastHitsFound = Physics.RaycastAll(relativityTransform.position, -BoosterForceApplier.direction(booster).asDirectionRelativeTo(relativityTransform), Mathf.Infinity, Physics.DefaultRaycastLayers);                         // get all raycast hits for raycasting from the booster in the direction of the booster's force
            if (Any.itemsIn(raycastHitsFound))
            {
                // determine the nearest raycast hit found's: hit distance, hit //
                float      nearestRaycastHitDistance = Mathf.Infinity;                          // initialize the nearest raycast hit's distance
                RaycastHit nearestRaycastHit         = raycastHitsFound[0];                     // initialize the nearest raycast hit to the first raycast hit found, by default (since it can't be null)
                foreach (RaycastHit raycastHitFound in raycastHitsFound)
                {
                    if (hitTriggerColliders || !raycastHitFound.collider.isTrigger)                                            // if trigger collider hits are allowed, or this raycast did not hit a trigger collider
                    {
                        float raycastHitFoundDistance = Vector3.Distance(relativityTransform.position, raycastHitFound.point); // determine this raycast's hit distance
                        // if this raycast's hit distance is less than the smallest distance found thus far, update the tracked nearest raycast hit and its distance to this raycast's //
                        if (raycastHitFoundDistance < nearestRaycastHitDistance)
                        {
                            nearestRaycastHitDistance = raycastHitFoundDistance;
                            nearestRaycastHit         = raycastHitFound;
                        }
                    }
                }

                // if the nearest raycast hit found is legal (based on the following conditions): track whether this diminisher is at distance to an antidiminisher, return the nearest raycast's hit distance //
                if (hitTriggerColliders || !nearestRaycastHit.collider.isTrigger)                                                                                                                                                                                                                                                      // if trigger collider hits are allowed, or the nearest raycast did not hit a trigger collider
                {
                    if (TerrainResponse.recognizedTypedTerrainLayerIndex(diminisher.recognizedTerrainType, nearestRaycastHit.transform.gameObject.layer))                                                                                                                                                                              // if the nearest raycast hit recognized terrain
                    {
                        BoosterAntidiminisher.antidiminisherFor(booster).atDistanceToAntidiminishor = BoosterAntidiminisher.antidiminishorLayer(nearestRaycastHit.transform.gameObject.layer) && (nearestRaycastHitDistance >= 0f) && (nearestRaycastHitDistance <= BoosterAntidiminisher.boosterAntidiminishingDistanceMax(booster)); // track whether this booster is at distance to an antidiminisher
                        return(nearestRaycastHitDistance);                                                                                                                                                                                                                                                                             // return the nearest raycast's hit distance
                    }
                }
                // otherwise (if the nearest raycast hit found is not legal): //
                else
                {
                    // track that this booster is not at distance to an antidiminisher //
                    BoosterAntidiminisher.antidiminisherFor(booster).atDistanceToAntidiminishor = false;
                }
            }
            // otherwise (if no raycast hits were found): //
            else
            {
                // track that this booster is not at distance to an antidiminisher //
                BoosterAntidiminisher.antidiminisherFor(booster).atDistanceToAntidiminishor = false;
            }

            // if nothing has been returned yet: consider the distance to terrain to be -1, as a flag of no recognized terrain being found (not 0, because returning 0 (as could have been returned above) would have indicated that recognized terrain was found at an immediate distance) //
            return(-1f);
        }
    }
Exemplo n.º 12
0
 public static bool CanActivate(BoosterDefinition boosterDefinition, SimulationObjectWrapper context)
 {
     return(Booster.CheckActivationPrerequisites(boosterDefinition, context) && (boosterDefinition.Effects == null || Booster.CanApplyAtLeastOneEffect(boosterDefinition, context)));
 }
Exemplo n.º 13
0
    // updating //


    // before the start: connect to the booster //
    protected virtual void Awake()
    {
        boosterTransform = transform.parent;
        booster          = boosterTransform.GetComponent <Booster>();
    }
Exemplo n.º 14
0
 public void removeBooster(Booster.Model type)
 {
     for (int i = 0; i< boosters.Count; i++)
     {
         Booster b = boosters[i];
         if (b.getModel().Equals(type))
         {
             boosters.RemoveAt(i);
         }
     }
 }
Exemplo n.º 15
0
 public bool hasBooster(Booster.Model model)
 {
     foreach (Booster b in boosters)
         if (b.getModel().Equals(model))
             return true;
     return false;
 }
Exemplo n.º 16
0
        }                                               // animation to play when doodle & booster collide

        /// <summary>
        /// constructor to create a collision manager
        /// </summary>
        /// <param name="game">game</param>
        /// <param name="doodle">doodle sprite</param>
        /// <param name="hitSound">sound when hit</param>
        /// <param name="booster">booster sprite</param>
        public DoodleBoosterColMng(Game game, Doodle doodle, SoundEffect hitSound, Booster booster) : base(game, doodle, hitSound)
        {
            this.booster = booster;
        }
Exemplo n.º 17
0
    void Update()
    {
        if (MissionSetting.FlowerChart != null)
        {
            // Light
            if (Spotlight != null)
            {
                switch (MissionSetting.FlowerChart.GetIntegerVariable("ItemLight"))
                {
                case 0:
                    Spotlight.GetComponent <Image> ().enabled = false;
                    Spotlight.transform.position = Vector3.Lerp(Spotlight.transform.position, MidScreen, 10 * Time.deltaTime);
                    break;

                case 1:
                    Spotlight.GetComponent <Image> ().enabled = true;
                    Spotlight.transform.position = Vector3.Lerp(Spotlight.transform.position, Item_1.transform.position, 5 * Time.deltaTime);
                    if (Item_1.transform.rotation != Quaternion.Euler(0, 0, 0))
                    {
                        Item_1.transform.rotation *= Quaternion.Euler(0, -100 * Time.deltaTime, 0);
                    }
                    Item_1.GetComponent <Image> ().color = new Color(255, 255, 255, 1);
                    Item_2.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f);
                    Item_3.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f);
                    break;

                case 2:
                    Spotlight.GetComponent <Image> ().enabled = true;
                    Spotlight.transform.position = Vector3.Lerp(Spotlight.transform.position, Item_2.transform.position, 5 * Time.deltaTime);
                    Item_1.transform.rotation    = Quaternion.Euler(0, 0, 0);
                    if (Item_2.transform.rotation != Quaternion.Euler(0, 0, 0))
                    {
                        Item_2.transform.rotation *= Quaternion.Euler(0, -100 * Time.deltaTime, 0);
                    }
                    Item_1.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f);
                    Item_2.GetComponent <Image> ().color = new Color(255, 255, 255, 1);
                    Item_3.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f);
                    break;

                case 3:
                    Spotlight.GetComponent <Image> ().enabled = true;
                    Spotlight.transform.position = Vector3.Lerp(Spotlight.transform.position, Item_3.transform.position, 5 * Time.deltaTime);
                    Item_2.transform.rotation    = Quaternion.Euler(0, 0, 0);
                    if (Item_3.transform.rotation != Quaternion.Euler(0, 0, 0))
                    {
                        Item_3.transform.rotation *= Quaternion.Euler(0, -100 * Time.deltaTime, 0);
                    }
                    Item_1.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f);
                    Item_2.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f);
                    Item_3.GetComponent <Image> ().color = new Color(255, 255, 255, 1);
                    break;

                case 4:
                    Spotlight.GetComponent <Image> ().enabled = true;
                    Item_3.transform.rotation            = Quaternion.Euler(0, 0, 0);
                    Item_1.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f);
                    Item_2.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f);
                    Item_3.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f);
                    break;
                }
            }

            if (Global.Level == "1")
            {
                if (MissionSetting.FlowerChart.FindBlock("買麵包") != null && MissionSetting.FlowerChart.FindBlock("買麵包").IsExecuting() && Bread != null && Bread.activeSelf)
                {
                    Bread.GetComponent <Renderer> ().enabled = true;
                    PlayerStatusImage.GetStatus("None");
                    Bread.transform.position = Vector3.MoveTowards(Bread.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0), 0.02f);
                    if (Vector3.Distance(Bread.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0)) < 0.01f)
                    {
                        Bread.SetActive(false);
                    }
                }

                if (MissionSetting.FlowerChart.GetBooleanVariable("TakeKey"))
                {
                    Key.transform.GetChild(0).GetComponent <Renderer> ().enabled = true;
                    Key.transform.GetChild(1).GetComponent <Renderer> ().enabled = true;
                    PlayerStatusImage.GetStatus("None");
                    Key.transform.position = Vector3.MoveTowards(Key.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0), 0.02f);
                    if (Vector3.Distance(Key.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0)) < 0.01f)
                    {
                        Key.transform.GetChild(0).GetComponent <Renderer> ().enabled = false;
                        Key.transform.GetChild(1).GetComponent <Renderer> ().enabled = false;
                    }
                }
            }

            if (Global.Level == "2")
            {
                if (MissionSetting.FlowerChart.GetBooleanVariable("TakeBooster"))
                {
                    Booster.GetComponent <Renderer> ().enabled = true;
                    PlayerStatusImage.GetStatus("None");
                    Booster.transform.position = Vector3.MoveTowards(Booster.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0), 0.02f);
                    if (Vector3.Distance(Booster.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0)) < 0.01f)
                    {
                        Booster.GetComponent <Renderer> ().enabled = false;
                        Item_1.GetComponent <Image> ().color       = new Color(255, 255, 255, 1);
                    }
                }

                if (MissionSetting.FlowerChart.GetBooleanVariable("TakeFire"))
                {
                    //FireBottle.GetComponent<Renderer> ().enabled = true;
                    showRenderer(FireBottle, true);
                    PlayerStatusImage.GetStatus("None");
                    FireBottle.transform.position = Vector3.MoveTowards(FireBottle.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0), 0.02f);
                    if (Vector3.Distance(FireBottle.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0)) < 0.01f)
                    {
                        showRenderer(FireBottle, false);
                        Item_2.GetComponent <Image> ().color = new Color(255, 255, 255, 1);
                    }
                }

                if (MissionSetting.FlowerChart.GetBooleanVariable("TakeOil"))
                {
                    PlayerStatusImage.GetStatus("None");
                    Item_3.GetComponent <Image> ().color = new Color(255, 255, 255, 1);
                }
            }

            if (Global.Level == "3")
            {
            }
        }
    }
Exemplo n.º 18
0
 public virtual void SetBooster(Booster booster)
 {
 }
Exemplo n.º 19
0
 public void dropBooster(Booster.Model model)
 {
     GameManager.getLevelGUI().droppedBooster(model);
     collectedBoosters.Add(Booster.initFromModel(model));
 }
Exemplo n.º 20
0
    // updating //


    // before the start: connect to: the booster, this booster jet audio //
    private void Awake()
    {
        booster        = transform.parent.parent.GetComponent <Booster>();
        audioComponent = GetComponent <AudioSource>();
    }
    // methods //


    // method: determine the (boolean) state of this Dependency Requisite //
    public override bool state()
    {
        return(Booster.bothHandsAreBoosting());
    }
Exemplo n.º 22
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="model"></param>
 public ClassificationXGBoostModel(Booster model)
 {
     m_model = model ?? throw new ArgumentNullException(nameof(model));
 }
 private void setReward(Booster.Model booster)
 {
     int b = (int)booster;
     transform.Find("Reward").GetComponent<Image>().sprite = Resources.LoadAll<Sprite>("GUI/Boosters/Booster_" + b)[0];
 }
Exemplo n.º 24
0
 protected override void Awake()
 {
     base.Awake();
     _booster = (Booster) Instantiate(booster);
 }
Exemplo n.º 25
0
 public void setModel(Booster.Model model)
 {
     this.model = model;
     gameObject.GetComponent<MeshRenderer>().material = Resources.Load<Material>("Materials/Boosters/Booster_" + (int)model);
 }
Exemplo n.º 26
0
 private void UsedBooster(Booster booster)
 {
     _minSpeed += booster.Value;
     _maxSpeed += booster.Value;
 }
Exemplo n.º 27
0
 public bool CanUpgradeBooster(Booster booster)
 {
     return(booster.Count >= GetBoosterCardCountNextLevel(booster.Level));
 }
Exemplo n.º 28
0
 public void Init(float[][] data, float[] labels)
 {
     XGBTrain = new DMatrix(data, labels);
     booster  = new Booster(XGBTrain);
     booster.SetParametersGeneric(parameters);
 }
Exemplo n.º 29
0
 public void LoadModelFromFile(string fileName)
 {
     booster = new Booster(fileName);
 }
Exemplo n.º 30
0
 public void setChallenge(int id, Booster.Model boosterReward, int scoreReward)
 {
     this.id = id;
     this.boosterReward = boosterReward;
     this.scoreReward = scoreReward;
 }
Exemplo n.º 31
0
 public void AddBooster(Booster ExtraBooster)
 {
     this.cardList.AddRange(ExtraBooster.cardList);
 }