Example #1
0
 private void LoadCardInfo(int i)
 {
     if (layers[i] != null)       // just to be safe
     {
         notRevealedCard.SetActive(false);
         LayerProperty current = layers[i];
         //LayerType currentType = current.type;
         String layerName = current.GetPrintName();
         if (isNone[i])
         {
             // swap to other card
             notRevealedCard.SetActive(true);
             String printName = "Not Revealed";
             rock.sprite = GetSpriteByName(printName);
             number.text = (i + 1).ToString();
         }
         else
         {
             name.text         = current.GetPrintName();
             permeability.text = current.GetPorosity().ToString() + " %";
             density.text      = current.GetDensity().ToString() + " kg/m^3";
             probability.text  = String.Format("{0:F0}", current.GetPossibility()) + " %";        // format to chop off extra decimals
             number.text       = (i + 1).ToString();
             rock.sprite       = GetSpriteByName(current.GetPrintName());
         }
     }
 }
    void OnTriggerEnter2D(Collider2D other)
    {
        switch (other.tag)
        {
        case "layer":
            LayerProperty layerProp = other.GetComponent <LayerProperty>();

            speedFactor  = layerProp.GetSpeedFactor();
            damageFactor = layerProp.GetDamageFactor();

            CameraShaking.instance.SetShakingPower((layerProp.GetDensity() / 70f) * 0.05f + 0.07f);

            layerIndicate.renderer.material.color = DataManager.instance.GetColorOfType(layerProp.type);

            break;

        case "PlanMarker":

            Marker markerCtrl = other.GetComponent <Marker>();

            float        fossilfuel     = markerCtrl.GetFossilFuelHere();
            GameObject   feedback       = Instantiate(feedbackText, transform.position + Vector3.up, Quaternion.identity) as GameObject;
            TextFeedback feedbackScript = feedback.GetComponent <TextFeedback>();
            if (fossilfuel > 0)
            {
                if (fossilfuel > DataManager.instance.GetAvgScore())
                {
                    feedbackScript.SetText(2, (fossilfuel / DataManager.instance.GetTotalScore()) * 7000000);
                }
                else
                {
                    feedbackScript.SetText(1, (fossilfuel / DataManager.instance.GetTotalScore()) * 7000000);
                }

                DataManager.instance.AddToScore(fossilfuel);
                SoundFXCtrl.instance.PlaySound(7, 1);
            }
            else
            {
                feedbackScript.SetText(0, 0);
            }

            if (markerCtrl.HasBeenSampled())
            {
                float fossilPossibility = markerCtrl.GetAvgPossibilityHere();
                if (fossilPossibility < 30)
                {
                    if (fossilfuel > 0)
                    {
                        PlanPathManager.instance.PauseDrill(0);
                    }
                    else
                    {
                        PlanPathManager.instance.PauseDrill(1);
                    }
                }
                else if (fossilPossibility < 70)
                {
                    if (fossilfuel > 0)
                    {
                        PlanPathManager.instance.PauseDrill(2);
                    }
                    else
                    {
                        PlanPathManager.instance.PauseDrill(3);
                    }
                }
                else
                {
                    if (fossilfuel > 0)
                    {
                        PlanPathManager.instance.PauseDrill(4);
                    }
                    else
                    {
                        PlanPathManager.instance.PauseDrill(5);
                    }
                }
            }
            else
            {
                if (DataManager.instance.GetLayerShape(markerCtrl.HoldLayerName()) == LayerShape.Normal)
                {
                    if (fossilfuel > 0)
                    {
                        PlanPathManager.instance.PauseDrill(9);
                    }
                    else
                    {
                        PlanPathManager.instance.PauseDrill(8);
                    }
                }
                else
                {
                    if (fossilfuel > 0)
                    {
                        PlanPathManager.instance.PauseDrill(6);
                    }
                    else
                    {
                        PlanPathManager.instance.PauseDrill(7);
                    }
                }
            }
            break;
        }
    }