Example #1
0
 void Update()
 {
     //if pause is on, we cannot drag them
     if (!menuScript.pause)
     {
         //we use raycast to catch the drag collider
         if (Input.GetMouseButtonDown(0))
         {
             Ray ray = Camera.mainCamera.ScreenPointToRay(Input.mousePosition);
             if (Physics.Raycast(ray, out hit))
             {
                 if (hit.collider.gameObject.layer == 8)
                 {
                     objectGo = hit.collider.gameObject;
                     onDrag = true;
                 }
             }
         }
         //If we clicked or touched now the balloon position belongs to our cursor o finger position
         if (onDrag)
         {
             posMouse = Camera.mainCamera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.mainCamera.nearClipPlane + 30));
             if (objectGo != null)
             {
                 ballonScript = objectGo.transform.root.gameObject.GetComponent<Balloon>();
                 if (ballonScript.Idballoon == "red" || ballonScript.Idballoon == "green" || ballonScript.Idballoon == "blue" || ballonScript.Idballoon == "yellow")
                 {
                     faceManager = objectGo.transform.root.GetComponentInChildren<FaceManager>();
                 }
                 if (faceManager != null)
                 {
                     faceManager.gameObject.renderer.material.mainTexture = faceManager.facesList[1];
                 }
                 objectGo.transform.position = posMouse;
             }
             else
             {
                 onDrag = false;
             }
         }
         //
         //If we stop dragging now the balloon has his own position
         if (Input.GetMouseButtonUp(0))
         {
             onDrag = false;
             if (objectGo != null)
             {
                 ballonScript = objectGo.transform.root.gameObject.GetComponent<Balloon>();
                 ballonScript.aceleration = -1;
                 if (ballonScript.Idballoon == "red" || ballonScript.Idballoon == "green" || ballonScript.Idballoon == "blue" || ballonScript.Idballoon == "yellow")
                 {
                     randomFace = Random.Range(0, 11);
                     faceManager.gameObject.renderer.material.mainTexture = faceManager.facesList[randomFace];
                 }
                 objectGo = null;
             }
         }
         //
     }
 }
    public void Deselect(Transform t)
    {
        Transform   hitParent   = selectedDict[t];
        FaceManager faceManager = hitParent.GetComponent <FaceManager>();

        switch (selectionMode)
        {
        case SelectionMode.selectObject:
            foreach (FaceButton face in faceManager.faceButtons)
            {
                face.GetComponent <MeshRenderer>().material.color = face.GetComponent <ButtonStyleExample>().normalColor;
                selectedList.Remove(face.transform);
                face.transform.SetParent(selectedDict[face.transform]);
                selectedDict.Remove(face.transform);
            }
            break;

        case SelectionMode.selectFace:

            t.GetComponent <MeshRenderer>().material.color = t.GetComponent <ButtonStyleExample>().normalColor;
            selectedList.Remove(t);
            t.SetParent(selectedDict[t]);
            selectedDict.Remove(t);

            break;
        }

        //t.SetParent(null);
    }
Example #3
0
    public void Run(FaceManager manager)
    {
        this.manager = manager;
#if UNITY_EDITOR
        UnityARSessionNativeInterface.ARFaceAnchorAddedEvent   += FaceUpdated;
        UnityARSessionNativeInterface.ARFaceAnchorUpdatedEvent += FaceUpdated;
        UnityARSessionNativeInterface.ARFaceAnchorRemovedEvent += FaceRemoved;
#endif

        UnityARSessionNativeInterface.ARFrameUpdatedEvent += FrameUpdated;
        if (!faceGo)
        {
            faceGo = new GameObject("FaceDataAdapterGo").transform;
            faceGo.gameObject.AddComponent <MeshFilter>();
            faceGo.gameObject.AddComponent <MeshRenderer>().sharedMaterial = new Material(Shader.Find("Unlit/Color"));
            faceGo.transform.parent = manager.faceVideo.transform.parent;
        }
        if (!leftEye)
        {
            leftEye = new GameObject("leftEye").transform;
            leftEye.transform.parent = faceGo.transform;
        }
        if (!rightEye)
        {
            rightEye = new GameObject("rightEye").transform;
            rightEye.transform.parent = faceGo.transform;
        }
    }
        public MainPage()
        {
            // one sensor is currently supported
            this.kinectSensor = KinectSensor.GetDefault();


            this.coordinateMapper = this.kinectSensor.CoordinateMapper;

            this.multiSourceFrameReader = this.kinectSensor.OpenMultiSourceFrameReader(FrameSourceTypes.Infrared | FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.BodyIndex | FrameSourceTypes.Body);

            this.multiSourceFrameReader.MultiSourceFrameArrived += this.Reader_MultiSourceFrameArrived;

            this.faceManager = new FaceManager(this.kinectSensor, this.faceFrameFeatures);

            // set IsAvailableChanged event notifier
            this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged;

            // use the window object as the view model in this simple example
            this.DataContext = this;

            // open the sensor
            this.kinectSensor.Open();

            this.InitializeComponent();

            this.Loaded += MainPage_Loaded;

            this.gestureDetectorList = new List <GestureDetector>();
            Gesture_Loaded("");
        }
Example #5
0
    public void TakeVideo(FaceManager fm, UnityEngine.UI.Image checkImg, RectTransform full)
    {
        view.transform.GetChild(0).gameObject.SetActive(false);

        fm.setUpDelegates();
        fm.ChangeLook();

        CamVideo cv = Camera.main.gameObject.AddComponent <CamVideo>();
        Image    i  = createVidJuice(checkImg);

        cv.init(view.rectTransform, full, (int save) =>
        {
            int w = cv.w;
            int h = cv.h;
            l.Init(false);
            if (save > 0)
            {
                StartCoroutine(saveT(cv, w, h));
            }
            fm.removeAll();
            Destroy(i.gameObject);
            check.interactable = false;
            check.onClick.RemoveAllListeners();
            check.onClick.AddListener(() => TakeVideo(fm, checkImg, full));
            checkImg.sprite = Resources.Load <Sprite>("play");

            //  Directory.Delete(m_FilePath, true); // NativeGallery.GetSavePath(persis, "", "LPM{0}.gif")
        }, i);
        // StartCoroutine(gettingVideo(cv));
        OnlySeeCheckButton();

        check.onClick.RemoveAllListeners();
        check.onClick.AddListener(() => StopVideo(cv));
        checkImg.sprite = Resources.Load <Sprite>("stop");
    }
Example #6
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            FaceManager.Base.Name = "人脸中心";
            FaceManager.Url       = "ipc://FaceChannel/FaceServer";
            FaceManager.SetError += FaceManager_SetError;;
            FaceManager.Start(_cancelRefresh.Token);

            InterceptMouse.MouseClick += InterceptMouse_MouseClick;

            SetWindowPos(_position);

            // 后台自动检查更新
            var task = Task.Run(() =>
            {
                NormalResult result = WpfClientInfo.InstallUpdateSync();
                if (result.Value == -1)
                {
                    SetError("update", "自动更新出错: " + result.ErrorInfo);
                }
                else if (result.Value == 1)
                {
                    SetError("update", result.ErrorInfo);
                    // Updated?.Invoke(this, new UpdatedEventArgs { Message = result.ErrorInfo });
                }
                else if (string.IsNullOrEmpty(result.ErrorInfo) == false)
                {
                    SetError("update", result.ErrorInfo);
                }
            });
        }
Example #7
0
    // Use this for initialization
    void Start()
    {
        Instance = this;

        // Set up a GestureRecognizer to detect Select gestures.
        gesture_recognizer_              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        gesture_recognizer_.TappedEvent += (source, tapCount, ray) =>
        {
            if (!_processing)
            {
                _processing = true;
                status.GetComponent <TextMesh>().text = "Photo taken !";
                status.SetActive(true);
                UnityEngine.XR.WSA.WebCam.PhotoCapture.CreateAsync(false, OnPhotoCaptureCreated);
            }
            else
            {
                status.GetComponent <TextMesh>().text = "Please wait...";
                status.SetActive(true);
            }
        };
        gesture_recognizer_.StartCapturingGestures();
        status.GetComponent <TextMesh>().text = "Photo taken !";
        _processing = true;

        UnityEngine.XR.WSA.WebCam.PhotoCapture.CreateAsync(false, OnPhotoCaptureCreated);

        // Décommenter la partie suivante pour une execution en temps réel.
        // InvokeRepeating("OnPhotoCaptureCreated", 5, 2);
    }
Example #8
0
 async Task <RecognitionFaceResult> RecognitionFace(string style)
 {
     // EnableControls(false);
     try
     {
         return(await Task.Run <RecognitionFaceResult>(() =>
         {
             var result = FaceManager.GetState("camera");
             if (result.Value == -1)
             {
                 return new RecognitionFaceResult
                 {
                     Value = -1,
                     ErrorInfo = result.ErrorInfo,
                     ErrorCode = result.ErrorCode
                 }
             }
             ;
             return FaceManager.RecognitionFace("");
         }));
     }
     finally
     {
         // EnableControls(true);
     }
 }
Example #9
0
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            // EnterMode("standby");

            FaceManager.CancelRecognitionFace();
            _stopVideo = true;
        }
Example #10
0
 void DisplayVideo()
 {
     while (_stopVideo == false)
     {
         var result = FaceManager.GetImage("");
         if (result.ImageData == null)
         {
             Thread.Sleep(500);
             continue;
         }
         MemoryStream stream = new MemoryStream(result.ImageData);
         try
         {
             Application.Current.Dispatcher.Invoke(new Action(() =>
             {
                 SetPhoto(stream);
             }));
             stream = null;
         }
         finally
         {
             if (stream != null)
             {
                 stream.Close();
             }
         }
     }
 }
Example #11
0
 public OriFace(Material m)
 {
     Men       = new GameObject();
     fm        = Men.AddComponent <FaceManager>();
     hight     = 0;
     irogami   = m;
     selecting = false;
 }
Example #12
0
 private void Awake()
 {
     instance    = this;
     faceInfoMap = new Dictionary <string, FaceInfo>();
     for (int i = 0; i < faceInfos.Count; ++i)
     {
         faceInfoMap[faceInfos[i].faceName] = faceInfos[i];
     }
 }
Example #13
0
    public void Start()
    {
        fm            = GameObject.FindGameObjectWithTag("Player").GetComponent <FaceManager>();
        items         = new List <ShopItem>();
        actualContent = (RectTransform)transform.GetChild(0).GetChild(1).GetChild(0).GetChild(0);
        items.Add(actualContent.GetChild(0).GetComponent <ShopItem>());

        dressUp();
    }
 private void Awake()
 {
     DirectorController = FindObjectOfType <DirectorController>();
     BallController     = FindObjectOfType <BallController>();
     LifeManager        = FindObjectOfType <LifeManager>();
     SceneController    = FindObjectOfType <SceneController>();
     SinisterFlashes    = FindObjectOfType <SinisterFlashes>();
     MenuController     = FindObjectOfType <MenuController>();
     FaceManager        = FindObjectOfType <FaceManager>();
 }
Example #15
0
 // Assigns the VoronoiFace struct to the FaceManager object belonging to the object containing the mesh.
 private void AssignVoronoiFace(VoronoiFace face_struct, FaceManager face_manager)
 {
     face_manager.id            = face_struct.id;
     face_manager.origin_x      = face_struct.origin_x;
     face_manager.origin_y      = face_struct.origin_y;
     face_manager.half_edges    = face_struct.half_edges;
     face_manager.neighbors_ids = face_struct.neighbors;
     face_manager.area          = face_struct.area;
     face_manager.merged        = face_struct.merged;
 }
Example #16
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Example #17
0
 private void Awake()
 {
     m_OnMouseOver       = new UnityEvent();
     m_OnMouseExit       = new UnityEvent();
     m_OnLock            = new UnityEvent();
     m_OnStart           = new UnityEvent();
     m_Renderer          = GetComponent <TileRenderer>();
     m_Renderer.Settings = m_Settings;
     m_FaceManager       = GetComponent <FaceManager>();
     m_Events            = GetComponentsInChildren <TileEventsDatas>();
 }
    void Start()
    {
        InitFaceIDSDK();

        faceTrack   = new FaceTrack();
        faceManager = new FaceManager();
        faceCompare = new FaceCompare();

        LoadDBFace();
        StartFaceTrack(deviceId);
    }
Example #19
0
        private void OnClickFaceAuthWithCrpObj(object sender, EventArgs e)
        {
            string Tag = "FaceAuthWithCrpObj";

            Android.Content.PM.Permission permissionCheck = Android.Content.PM.Permission.Granted;
            if (Build.VERSION.SdkInt >= BuildVersionCodes.M)
            {
                permissionCheck = CheckSelfPermission(Manifest.Permission.Camera);
            }
            if (permissionCheck != Android.Content.PM.Permission.Granted)
            {
                log.Info(Tag, "The camera permission is not enabled. Please enable it.");

                // request camera permissions
                if (Build.VERSION.SdkInt >= BuildVersionCodes.M)
                {
                    RequestPermissions(new string[] { Manifest.Permission.Camera }, 1);
                }
                return;
            }
            BioAuthnCallback callback = new FidoBioAuthnCallback();
            // Cancellation Signal
            CancellationSignal cancellationSignal = new CancellationSignal();

            FaceManager faceManager = new FaceManager(this);

            Log.Info("HasEnrolledTemplates", faceManager.HasEnrolledTemplates.ToString());
            Log.Info("IsHardwareDetected", faceManager.IsHardwareDetected.ToString());
            Log.Info("CanAuth", faceManager.CanAuth().ToString());

            log.Info(Tag, $"IsHardwareDetected:{faceManager.IsHardwareDetected}");

            // Checks whether 3D facial authentication can be used.
            int errorCode = faceManager.CanAuth();

            if (errorCode != 0)
            {
                log.Info(Tag, "Can not authenticate. errorCode=" + errorCode);
                return;
            }
            // flags
            int flags = 0;

            // Authentication messsage handler.
            Handler handler = null;

            // Recommended CryptoObject to be set to null. KeyStore is not associated with face authentication in current
            // version. KeyGenParameterSpec.Builder.SetUserAuthenticationRequired() must be set false in this scenario.
            CryptoObject crypto = null;

            log.Info(Tag, "Start face authentication.\nAuthenticating......\n");
            faceManager.Auth(crypto, cancellationSignal, flags, callback, handler);
        }
Example #20
0
 void Awake()
 {
     if (!instance)
     {
         instance = this;
     }
     if (instance != this)
     {
         Destroy(gameObject);
     }
     FM = GetComponentInChildren <FaceManager>();
     StartUp();
 }
    public void Add(Transform t)
    {
        FaceManager faceManager = t.GetComponent <FaceManager>();

        foreach (FaceButton face in faceManager.faceButtons)
        {
            if (!selectedDict.ContainsKey(face.transform))
            {
                selectedList.Add(face.transform);
                selectedDict.Add(face.transform, face.transform.parent);
                selectionPivot.position = face.transform.position;
            }
        }
    }
Example #22
0
        public FaceViewModel(FaceManager faceManager, EmojiManager emojiManager, IEventAggregator ea)
        {
            EmojiFaceList = faceManager.EmojiFaceList;
            QQFaceList    = faceManager.QQFaceList;

            ClickFaceCommand = ReactiveCommand.Create <EmojiModel>(face =>
            {
                EmojiModel emoji = emojiManager.FaceToEmoji(face);
                if (emoji != null)
                {
                    ea.GetEvent <InputEmojiEvent>().Publish(emoji);
                }
            });
        }
Example #23
0
 public void Init(FaceManager fm)
 {
     d              = fm;
     d.OnSingleTap += Change;
     gameObject.SetActive(true);
     happy();
     nextActions = new Queue <Action>();
     nextActions.Enqueue(hello);
     nextActions.Enqueue(tapOnce);
     nextActions.Enqueue(tap);
     nextActions.Enqueue(tapTwice);
     nextActions.Enqueue(tapT);
     nextActions.Enqueue(thatsIt);
     Change();
 }
Example #24
0
        public async void RunFlow()
        {
            // 1) Pick a photo
            var photo = await TakePhoto();

            if (photo is null)
            {
                return;
            }

            // 2) Convert to appropriate type to process
            var convertedPicture = PictureConverter.ConvertToGray8(photo);

            // 3) Find faces
            var faces = await FaceManager.DetectFacesAsync(convertedPicture, photo);

            if (!faces.Any())
            {
                return;
            }

            // 4) Compare back and front planes
            var(frontPixels, backPixels) = await PlaneComparator.GetFrontBackPixelsAsync(photo, faces);

            var contrastReport = PlaneComparator.CompareBackAndFrontAsync((frontPixels, backPixels));

            // 5) Are there strong light sources in background?
            var image = await ToUsableBitmapConverter.Convert(photo);

            var thresholdOverride = 255 * 3;
            var binaryImage       = SourcesDetector.GetBinary(image, thresholdOverride);
            var backLightReport   = SourcesDetector.AnalyzeBackground(binaryImage, frontPixels);

            // 6) Find lights in eyes
            var faceLightReport = SourcesDetector.AnalyzeFace(binaryImage, frontPixels);

            // 7) Combine messages and push notification
            var messages = new List <Report> {
                contrastReport,
                backLightReport,
                faceLightReport
            };

            if (!messages.All(m => m.IsEmpty()))
            {
                Notificator.Display(messages.Select(m => m.ToString()));
            }
        }
    public void OnSelect(RaycastHit hit)
    {
        Transform hitTarget = hit.transform;

        //Output a selection script!
        if (!selectedDict.ContainsKey(hitTarget))
        {
            //get editHandleGroup
            Transform   hitParent   = hit.transform.parent;
            FaceManager faceManager = hitParent.GetComponent <FaceManager>();

            if (faceManager == null)
            {
                Debug.Log("The parent is missing a face manager");
                return;
            }

            switch (selectionMode)
            {
            case SelectionMode.selectObject:

                foreach (FaceButton face in faceManager.faceButtons)
                {
                    selectedList.Add(face.transform);
                    selectedDict.Add(face.transform, face.transform.parent);
                    selectionPivot.position = face.transform.position;
                }

                break;

            case SelectionMode.selectFace:
                selectedList.Add(hitTarget);
                selectedDict.Add(hitTarget, hitTarget.transform.parent);
                selectionPivot.position = hitTarget.position;
                break;
            }

            SetPivotPoint();
        }
        else
        {
            //Hack
            Deselect(hit.transform);
            SetPivotPoint();
        }
    }
Example #26
0
        public MainPage()
        {
            // one sensor is currently supported
            this.kinectSensor = KinectSensor.GetDefault();

            this.coordinateMapper = this.kinectSensor.CoordinateMapper;

            this.multiSourceFrameReader = this.kinectSensor.OpenMultiSourceFrameReader(FrameSourceTypes.Infrared | FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.BodyIndex | FrameSourceTypes.Body);

            this.multiSourceFrameReader.MultiSourceFrameArrived += this.Reader_MultiSourceFrameArrived;

            // specify the required face frame results
            // init with all the features so they are accessible later.
            this.faceFrameFeatures =
                FaceFrameFeatures.BoundingBoxInColorSpace
                | FaceFrameFeatures.PointsInColorSpace
                | FaceFrameFeatures.BoundingBoxInInfraredSpace
                | FaceFrameFeatures.PointsInInfraredSpace
                | FaceFrameFeatures.RotationOrientation
                | FaceFrameFeatures.FaceEngagement
                | FaceFrameFeatures.Glasses
                | FaceFrameFeatures.Happy
                | FaceFrameFeatures.LeftEyeClosed
                | FaceFrameFeatures.RightEyeClosed
                | FaceFrameFeatures.LookingAway
                | FaceFrameFeatures.MouthMoved
                | FaceFrameFeatures.MouthOpen;

            this.faceManager = new FaceManager(this.kinectSensor, this.faceFrameFeatures);

            // set IsAvailableChanged event notifier
            this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged;

            // use the window object as the view model in this simple example
            this.DataContext = this;

            // open the sensor
            this.kinectSensor.Open();

            this.InitializeComponent();

            // new
            this.Loaded += MainPage_Loaded;
        }
Example #27
0
    public void mapMouseExit(GameObject objClicked)
    {
        //Debug.Log("Pointer Exit: " + objClicked.name);

        MeshRenderer mr = objClicked.GetComponent <MeshRenderer>();

        mr.material.color = normalColor;

        FaceManager[] face_managers = mapHolder.GetComponent <DelaunayTerrain>().faces_managers;
        FaceManager   current_face  = objClicked.GetComponent <FaceManager>();

        for (int i = 0; i < current_face.neighbors_ids.Count; ++i)
        {
            if (current_face.neighbors_ids[i] >= 0)
            {
                face_managers[current_face.neighbors_ids[i]].GetComponent <MeshRenderer>().material.color = normalColor;
            }
        }
    }
Example #28
0
    // face detection
    private IEnumerator DoFaceDetection()
    {
        // get the image to detect
        faces = null;
        Texture2D texCamShot = null;

        if (cameraShot)
        {
            texCamShot = (Texture2D)cameraShot.GetComponent <Renderer>().material.mainTexture;
        }

        yield return(null);

        try
        {
            // get the face manager instance
            FaceManager faceManager = FaceManager.Instance;

            if (texCamShot && faceManager)
            {
                SetHintText("Wait...");
                faces = faceManager.DetectFaces(texCamShot);

                if (faces != null && faces.Length > 0)
                {
                    faceManager.DrawFaceRects(texCamShot, faces, faceColors);
                    SetHintText("Click on the camera image to make a shot");
                }
                else
                {
                    SetHintText("No face(s) detected.");
                }
            }
        }
        catch (System.Exception ex)
        {
            Debug.LogError(ex.Message + '\n' + ex.StackTrace);
            SetHintText(ex.Message);
        }

        yield return(null);
    }
Example #29
0
        public void Read(JToken json)
        {
            if (json["age"] != null)
            {
                Age = json["age"]["value"].ToObject <int>();
            }

            if (json["blur"] != null)
            {
                Blur = new BlurData(json["blur"]);
            }

            if (json["ethnicity"] != null)
            {
                Ethnicity = json["ethnicity"]["value"].ToString();
            }

            if (json["eyestatus"] != null)
            {
                EyeStatus = new EyeStatus(json["eyestatus"]);
            }

            if (json["gender"] != null)
            {
                Gender = FaceManager.ParseGenger(json["gender"]["value"].ToString());
            }

            if (json["facequality"] != null)
            {
                FaceQuality = new ThresholdValue(json["facequality"]);
            }

            if (json["headpose"] != null)
            {
                Headpose = new Headpose(json["headpose"]);
            }

            if (json["smile"] != null)
            {
                Smiling = new ThresholdValue(json["smile"]);
            }
        }
Example #30
0
    void Update()
    {
        // check for mouse click
        if (Input.GetMouseButtonDown(0))
        {
            DoMouseClick();
        }

        if (Input.GetButton("Jump"))
        {
            //bool bRes = FaceManager.Instance.CreatePersonGroup("testusers", "Test Users", "group=test");
            //Debug.Log(bRes);
            FaceManager faceManager = FaceManager.Instance;
            Person[]    persons     = faceManager.ListPersonsInGroup("testusers");
            //Person person = faceManager.AddPersonToGroup("testusers", "Tester", "Here I come.");

            foreach (Person person in persons)
            {
                if (person != null)
                {
                    Debug.Log("Person " + person.Name + ", ID: " + person.PersonId);
                }
            }

            if (persons.Length > 0)
            {
                Texture2D texCamShot = (Texture2D)cameraShot.GetComponent <Renderer>().material.mainTexture;
                string    personId   = persons[0].PersonId.ToString();

                // add person face
                PersonFace face = faceManager.AddFaceToPerson("testusers", personId, string.Empty, null, texCamShot);
                Debug.Log("Added face: " + face.PersistedFaceId);

                // train the group
                faceManager.TrainPersonGroup("testusers");

                // check if training is finished
                Debug.Log("Trained: " + faceManager.IsPersonGroupTrained("testusers"));
            }
        }
    }
Example #31
0
    public void Start()
    {
        SwitchButtonColor(GetButtons(), new Color32((byte)PlayerPrefs.GetInt("themeR"), (byte)PlayerPrefs.GetInt("themeG"), (byte)PlayerPrefs.GetInt("themeB"), 255));

        fm            = GameObject.FindGameObjectWithTag("Player").GetComponent <FaceManager>();
        items         = new List <ShopItem>();
        actualContent = (RectTransform)transform.GetChild(0).GetChild(1).GetChild(0).GetChild(0);
        items.Add(actualContent.GetChild(0).GetComponent <ShopItem>());
        transform.GetChild(0).Find("optMotion").GetChild(0).GetComponent <Toggle>().isOn = PlayerPrefs.GetInt("motion") == 1 ? false : true;
        InitMasterColor();
        dressUp();

        int lang = PlayerPrefs.GetInt("Lang");

        if (lang != 0)
        {
            LanguageSupport ls = GetComponent <LanguageSupport>();
            ls.ChangeLanguage(lang);
            ls.setLanguageDropdown(lang);
        }
    }
Example #32
0
    void Start()
    {
        //if its the ray balloons, we have to initialize it with a color
        if (Idballoon == "theray")
        {
            randomRayColor = Random.Range(0, 4);

            if (randomRayColor == 0)
            {
                this.renderer.material.mainTexture = redBalloon;
            }
            else
            {
                if (randomRayColor == 1)
                {
                    this.renderer.material.mainTexture = greenBalloon;
                }
                else
                {
                    if (randomRayColor == 2)
                    {
                        this.renderer.material.mainTexture = blueBalloon;
                    }
                    else
                    {
                        if (randomRayColor == 3)
                        {
                            this.renderer.material.mainTexture = yellowBalloon;
                        }
                    }
                }
            }
        }
        //

        //If its the refresher (we have to destroy it cause if not, the user will use it his own benefit benefit forever)
        if (Idballoon == "orange")
        {
            Destroy(this.gameObject, 7);
        }
        //

        //Initialize
        faceManager = this.GetComponentInChildren<FaceManager>();
        menuScript = Camera.mainCamera.GetComponent<MenuManipulator>();
        soundScript = Camera.mainCamera.GetComponent<SoundManager>();
        score = GameObject.FindWithTag("Score");
        scoreScript = score.GetComponent<ScoreManipulator>();
        maxAcc = 0.5f;
        aceleration = -1;
        //
    }
Example #33
0
 private FaceManager()
 {
     instance = this;
 }