Example #1
0
    void Start()
    {
        pickUp = Toolbox.Instance.GetPlayer().GetComponent <MFPP.Modules.PickUpModule>();
        laserPreviewMaterial = laserPreview.material;
        laserPreviewMaterial.SetFloat("_Opacity", opacity);

        realPreviewMaterial = realPreview.material;
        realPreviewMaterial.SetFloat("_Opacity", opacity);


        laserCollider.GetComponent <Renderer>().GetPropertyBlock(laserArmPropBlock);
        realCollider.GetComponent <Renderer>().GetPropertyBlock(realArmPropBlock);

        //childrenTransitions = gameObject. GetComponentsInChildren<Transition>();


        Vector3 startScaled   = new Vector3(1, armScalingFactor * armScale, 1);
        Vector3 startUnscaled = new Vector3(1, 1, 1);

        if (this.gameObject.layer == 10)
        {
            laserCollider.transform.localScale = startScaled;
            realCollider.transform.localScale  = startUnscaled;
        }

        else
        {
            laserCollider.transform.localScale = startUnscaled;
            realCollider.transform.localScale  = startScaled;
        }
    }
Example #2
0
    void Start()
    {
/*
 *      //make sure player is seeing ladders in correct world
 *      if (space)
 *      {
 *          GetComponent<MFPP.Modules.LadderModule>().LadderLayerMask.value = 262144; //only see ladders in real world
 *      }
 *      else { GetComponent<MFPP.Modules.LadderModule>().LadderLayerMask.value = 524288; //only see ladders in laser world
 *      }
 */

        //Debug.Log(Camera.main.fieldOfView);

        mutationSpawner = GetComponent <MutationSpawner>();
        audioSource     = GetComponent <AudioSource>();
        rm = GetComponent <RaycastManager>();
        SoundBox box = SoundBox.Instance;

        flipSounds         = box.currentFlipPalette;
        flipFailClip       = box.flipFail;
        soundTrack         = GetComponentInChildren <SoundTrackManager>();
        flipburst          = GetComponentInChildren <flipburst>();
        transitionCollider = GetComponentInChildren <TransitionCollider>();
        eyeThatSeesList    = new List <EyeThatSees>();
        _pickupModule      = GetComponent <MFPP.Modules.PickUpModule>();

        eyesEffect = Camera.main.GetComponent <ImageEffectEyes>();
    }
Example #3
0
 void Start()
 {
     selectedObjs  = new List <GameObject>();
     mainCam       = Camera.main;
     audioSource   = GetComponent <AudioSource>();
     selectClip    = SoundBox.Instance.selection;
     deselectClip  = SoundBox.Instance.deselect;
     pickUp        = GetComponent <MFPP.Modules.PickUpModule>();
     iconContainer = Toolbox.Instance.GetIconContainer();
     Radius        = GetComponent <CharacterController>().radius;
 }
Example #4
0
    private void Start()
    {
        player = Toolbox.Instance.GetPlayer();
        box    = SoundBox.Instance;
        pickUp = player.GetComponent <MFPP.Modules.PickUpModule>();


        partSystem = GetComponent <ParticleSystem>();

        if (partSystem)
        {
            partSystem.emission.SetBursts(new ParticleSystem.Burst[3]);
        }
    }
Example #5
0
    public void UpdateToolbox()
    {
        if (!player)
        {
            player = GameObject.FindWithTag("Player");
        }

        if (!mainCanvas)
        {
            mainCanvas = GameObject.FindWithTag("Main Canvas");
        }

        playerCam      = player.GetComponentInChildren <Camera>();
        raycastManager = player.GetComponent <RaycastManager>();
        pickUp         = player.GetComponent <MFPP.Modules.PickUpModule>();
        flipScript     = player.GetComponent <flipScript>();
        UpdateTransforms();
        iconContainer = GameObject.FindWithTag("IconContainer").GetComponent <IconContainer>();
        pauseMenu     = GameObject.Find("PauseMenu");

        Application.backgroundLoadingPriority = ThreadPriority.Low;

        cameraFogStartDefault = Camera.main.GetComponent <UnityStandardAssets.ImageEffects.GlobalFog>().startDistance;
        fogDensityDefault     = RenderSettings.fogDensity;

        if (Toolbox.Instance == this)
        {
            SoundEffectsAudio = GameObject.Find("SoundEffectsAudio").GetComponent <AudioSource>();
        }

        Debug.Log("adding player info!");
        Toolbox.Instance.player         = player;
        Toolbox.Instance.playerCam      = playerCam;
        Toolbox.Instance.pickUp         = pickUp;
        Toolbox.Instance.raycastManager = raycastManager;
        Toolbox.Instance.flipScript     = flipScript;
        UpdateTransforms();
        Toolbox.Instance.iconContainer     = iconContainer;
        Toolbox.Instance.pauseMenu         = pauseMenu;
        Toolbox.Instance.SoundEffectsAudio = GameObject.Find("SoundEffectsAudio").GetComponent <AudioSource>();
        Toolbox.Instance.SoundtrackAudio   = GameObject.Find("LaserChords").GetComponent <AudioSource>();


        Toolbox.Instance.soundEffectsSlider = pauseMenu.transform.GetChild(2).GetComponent <Slider>();
        Toolbox.Instance.soundEffectsSlider.onValueChanged.AddListener(delegate { VolumeChangeCheck(); });
    }
Example #6
0
    public void Start()
    {
        if (!initialized)
        {
            start = this.transform.position;

            Color     RC = platformContainer.GetComponent <PlatformController>().RestingColor;
            Color     AC = platformContainer.GetComponent <PlatformController>().ActiveColor;
            Color     SC = platformContainer.GetComponent <PlatformController>().ShimmerColor;
            Texture2D ST = platformContainer.GetComponent <PlatformController>().ScrollText;

            this.Indicator.SetColors(RC, AC, SC, ST);

            raycastManager = Toolbox.Instance.GetPlayer().GetComponent <RaycastManager>();
            pickUp         = Toolbox.Instance.GetPlayer().GetComponent <MFPP.Modules.PickUpModule>();

            LR = gameObject.transform.parent.gameObject.GetComponentInChildren <LineRenderer>();
            LR.positionCount = 2;
            Vector3 begin = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y - 0.1f, gameObject.transform.position.z);
            LR.useWorldSpace = true;
            LR.SetPosition(0, begin);
            Vector3 finish = new Vector3(end.position.x, end.position.y - 0.1f, end.position.z);
            LR.SetPosition(1, finish);

            LR.material.SetColor("_RestingColor", RC);
            LR.material.SetColor("_ActiveColor", AC);
            LR.material.SetColor("_ShimmerColor", SC);
            LR.material.SetFloat("_isLineRenderer", 1.0f);

            //setup the audio
            if (!GetComponent <AudioSource>())
            {
                this.gameObject.AddComponent <AudioSource>();
            }
            audio = GetComponent <AudioSource>();
            audio.spatialBlend = 1f;
            audio.playOnAwake  = false;

            initialized = true;
        }
    }
Example #7
0
    public virtual void Start()
    {
        base.Start();

        player     = Toolbox.Instance.GetPlayer().GetComponent <MFPP.Player>();
        pickUp     = Toolbox.Instance.GetPickUp();
        audio      = GetComponent <AudioSource>();
        mainCamera = Camera.main;
        rigidbody  = GetComponent <Rigidbody>();
        //if (rigidbody)
        //{
        //    rigidbody.isKinematic = true;
        //}

        inMotion = false;

        particleTransitionBursts = GetComponentsInChildren <ParticleTransitionBurst>();
        if (particleTransitionBursts.Length > 0)
        {
            hasTransitionParticles = true;
        }
    }
Example #8
0
 private void Start()
 {
     pickUp = Toolbox.Instance.GetPlayer().GetComponent <MFPP.Modules.PickUpModule>();
 }
Example #9
0
    private IEnumerator CenterObjectRoutine()
    {
        //moves the sokoban into place


        objectToMove.GetComponent <HoldableObject>().inMotion = true;
        float elapsedTime = 0;
        float ratio       = elapsedTime / duration;

        MFPP.Modules.PickUpModule pickUp = Toolbox.Instance.GetPlayer().GetComponent <MFPP.Modules.PickUpModule>();

        if (pickUp.heldObject && pickUp.heldObject.Equals(objectToMove))
        {
            pickUp.PutDown();
        }


        //if the parent object has item properties it means that it is a sokoban
        if (parent.GetComponent <HoldableObject>())
        {
            //   Debug.Log("Sokoban");
            objectToMove.transform.parent = parent.transform;
            objectToMove.GetComponent <BoxCollider>().enabled = false;


            objectsPosition = objectToMove.transform.localPosition;
            moverPosition   = snap.localPosition;
            moverPosition.y = objectsPosition.y;

            //do the transition
            while (ratio < 1f)
            {
                elapsedTime += Time.deltaTime;
                ratio        = elapsedTime / duration;
                objectToMove.transform.localPosition = Vector3.Slerp(objectsPosition, moverPosition, ratio);
                yield return(null);
            }

            objectToMove.GetComponent <HoldableObject>().inMotion = false;
            objectToMove.GetComponent <BoxCollider>().enabled     = true;
            //   Debug.Log("done!" + parent.name);
        }

        //for NOT sokoban: aka static obj, we want to use its global position
        else
        {
            objectToMove.GetComponent <Renderer>().material.SetInt("_IsSelected", 0);

            // Debug.Log("Static");
            objectToMove.transform.parent = parent.transform;
            objectToMove.GetComponent <BoxCollider>().enabled = false;


            objectsPosition = objectToMove.transform.localPosition;
            moverPosition   = snap.localPosition;
            moverPosition.y = objectsPosition.y;


            while (ratio < 1f)
            {
                elapsedTime += Time.deltaTime;
                ratio        = elapsedTime / duration;
                objectToMove.transform.localPosition = Vector3.Slerp(objectsPosition, moverPosition, ratio);
                yield return(null);
            }
            objectToMove.GetComponent <HoldableObject>().inMotion = false;
            objectToMove.GetComponent <BoxCollider>().enabled     = true;


            // Debug.Log("done!" + parent.name);
        }


        AudioSource audioSource = GetComponentInParent <AudioSource>();

        mainGuard.SetActive(true);
    }
Example #10
0
 void Awake()
 {
     player = gameObject;
     pickUp = GetComponent <MFPP.Modules.PickUpModule>();
     //CheckForHeld();
 }