Exemple #1
0
    void Start()
    {
        audioSources = gameObject.GetComponents <AudioSource>();
        clockSrc     = audioSources[1];

        //make and begin running the state machine
        rhythmGameStateMachine = new FiniteStateMachine <RhythmGameController>(this);
        rhythmGameStateMachine.TransitionTo <IntroAnimation>();

        noteObjectsParent     = transform.GetChild(3).gameObject.GetComponent <Transform>();
        lifeSpritesController = transform.GetChild(5).gameObject.GetComponent <Transform>();

        //visual utility and feedback scripts
        fretFeedbackScript = transform.GetChild(0).gameObject.GetComponent <NewFretFeedback>();
        orbitterScript     = transform.GetChild(1).GetChild(0).gameObject.GetComponent <Orbitter>();
        background         = transform.GetChild(2).gameObject.GetComponent <SpriteRenderer>();
        backgroundScaler   = background.gameObject.GetComponent <ScaleObject>();

        rhythmGameDialogue = this.gameObject.GetComponent <RhythmGameDialogue>();

        //generate the random combination for the second phase of the song and make the song into one string
        GenerateCombinations();

        this.thisSongSequence = notesCombinations.ToArray();

        GenerateNotes();
    }
Exemple #2
0
    void Start()
    {
        startPos = this.transform.position;
        Debug.Log("angular speed will be: " + angularSpeed);
        objectScalerScript = gameObject.GetComponent <ScaleObject>();

        radius = (child.position - pivot.position).magnitude;

        Debug.Log("Radius is: " + radius);
    }
Exemple #3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        Seed  seed  = other.GetComponent <Seed>();
        Spore spore = other.GetComponent <Spore>();

        if (null != seed && seed.IsCaptured)
        {
            return;
        }

        if ((IsFertil || GameManager.Instance.IsNewFlowerReplaceOldOne) && null != seed)
        {
            seed.IsCaptured = true;

            int previousLevel = 0;

            if (GameManager.Instance.IsNewFlowerReplaceOldOne)
            {
                if (null != PlantedFlower)
                {
                    FlowerRoot flower     = PlantedFlower.GetComponent <FlowerRoot>();
                    FlowerRoot seedFlower = seed.Flower.GetComponent <FlowerRoot>();

                    if (flower.Level == seedFlower.Level && flower.GrowthLevel < 3)
                    {
                        previousLevel = flower.GrowthLevel;
                        PlantedFlower.GetComponent <FlowerRoot>().Kill();
                        CreateTheFlower(seed, previousLevel + 1, this.transform);
                    }
                }
                else
                {
                    CreateTheFlower(seed, 1, this.transform);
                }

                seed.StopFade();
                ScaleObject scale = seed.gameObject.AddComponent <ScaleObject>();
                scale.GetComponent <Rigidbody2D>().isKinematic = true;
                scale.Scale(0.2f, Vector3.zero, true, Center.position, AbsorbIsFinish);
            }
        }

        if (null != spore)
        {
            if ((Time.time - spore.BirthTime) > 1f)
            {
                spore.Kill();
            }
        }
    }
 void TurnOffLights()
 {
     DimSwitches();
     starField.Stop();
     StartCoroutine(LowerLightIntensity());
     StartCoroutine(FadeDarkStarSprite());
     GameStateHandler.player.GetComponent <HandleChildParticleSystems>().ChangeColorOfAura(this.gameObject, Color.clear);
     ScaleObject.AdjustLightIntensity(this, GameStateHandler.player.GetComponentInChildren <Light>(), 1.0f, 1.0f);
     foreach (Light light in playerLights)
     {
         if (light != null)
         {
             ScaleObject.DimLightOverTime(light, 2, 2);
             light.enabled = false;
         }
     }
 }
    public override void OnInspectorGUI()
    {
        GUIStyle HeaderStyle = new GUIStyle();

        HeaderStyle.fontSize  = 15;
        HeaderStyle.fontStyle = FontStyle.Bold;

        DrawDefaultInspector();
        ScaleObject ScaleObject = (ScaleObject)target;

        GUILayout.Space(10);
        EditorGUILayout.LabelField("Właściwości skalowania:", HeaderStyle, GUILayout.Height(20));
        ScaleObject.ScallingSpeed = EditorGUILayout.Slider("Prędkość skalowania:", ScaleObject.ScallingSpeed, 0, 0.15f);
        EditorGUILayout.LabelField("Minimalna wielkość:", ScaleObject.min.ToString("0.00"));
        EditorGUILayout.LabelField("Maksymalna wielkość:", ScaleObject.max.ToString("0.00"));
        EditorGUILayout.MinMaxSlider(ref ScaleObject.min, ref ScaleObject.max, 0, 2);

        if (GUILayout.Button("Zeruj ustawienia"))
        {
            ScaleObject.min           = 0.8f;
            ScaleObject.max           = 1.2f;
            ScaleObject.ScallingSpeed = 0;
        }
    }
 void FadeBurstLight()
 {
     ScaleObject.AdjustLightIntensity(this, ourLight, 0.5f, 3.0f);
 }
 void Start()
 {
     spriteRenderer       = gameObject.GetComponent <SpriteRenderer>();
     objectScalerScript   = gameObject.GetComponent <ScaleObject>();
     rippleParticleSystem = transform.GetChild(0).gameObject.GetComponent <ParticleSystem>();
 }
 void FadePointLight()
 {
     ScaleObject.DimLightOverTime(ourLight, 0, 2);
 }