Inheritance: MonoBehaviour
コード例 #1
0
    // Use this for initialization
    void Start()
    {
        m_planeManagerA = ARContentA.GetComponentInChildren <PlaneManager>();
        m_planeManagerB = ARContentB.GetComponentInChildren <PlaneManager>();

        m_anchorInputListenerBehaviourA = ARContentA.GetComponentInChildren <AnchorInputListenerBehaviour>();
        m_anchorInputListenerBehaviourB = ARContentB.GetComponentInChildren <AnchorInputListenerBehaviour>();

        m_planeFinderBehaviourA = ARContentA.GetComponentInChildren <PlaneFinderBehaviour>();
        m_planeFinderBehaviourB = ARContentB.GetComponentInChildren <PlaneFinderBehaviour>();

        m_contentPositioningBehaviourA = ARContentA.GetComponentInChildren <ContentPositioningBehaviour>();
        m_contentPositioningBehaviourB = ARContentB.GetComponentInChildren <ContentPositioningBehaviour>();

        m_anchorBehaviourA = ARContentA.GetComponentInChildren <AnchorBehaviour>();
        m_anchorBehaviourB = ARContentB.GetComponentInChildren <AnchorBehaviour>();

        m_productPlacementA = ARContentA.GetComponentInChildren <ProductPlacement>();
        m_productPlacementB = ARContentB.GetComponentInChildren <ProductPlacement>();

        m_touchHandlerA = ARContentA.GetComponentInChildren <TouchHandler>();
        m_touchHandlerB = ARContentB.GetComponentInChildren <TouchHandler>();

        TurnOffBehaviour(false);
        TurnOffBehaviour(true);
        TurnOffBehaviour(false);
    }
コード例 #2
0
        IEnumerator PlaneArrival(GameObject plane)
        {
            PlaneManager planeM = plane.GetComponent <PlaneManager>();
            float        toZ    = -58;

            while (plane.transform.localPosition.z < toZ)
            {
                Vector3 oldPosition = plane.transform.localPosition;
                float   newZPos     = oldPosition.z + Time.deltaTime * 5f;
                if (newZPos > toZ)
                {
                    newZPos = toZ;
                }
                Vector3 newPosition = new Vector3(oldPosition.x, oldPosition.y, newZPos);
                plane.transform.localPosition = newPosition;

                yield return(null);
            }

            planes.Add(planeM.indexParking, plane);

            Debug.Log("Самолёт №" + planeM.indexParking + ": прилетел");
            //trackArrivalCount++;
            yield break;
        }
コード例 #3
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        PlanePool = new List <GameObject>();

        RegionBehaviour[] regions = FindObjectsOfType <RegionBehaviour>();
        foreach (RegionBehaviour region in regions)
        {
            //region.region.regionClicked += () =>
            //{
            //    if(SourceRegion == null)
            //    {
            //        SourceRegion = region;
            //        return;
            //    } else
            //    {
            //        DestinationRegion = region;
            //        SendPlane(SourceRegion, DestinationRegion);
            //        SourceRegion = null;
            //        DestinationRegion = null;
            //    }
            //};
        }
    }
コード例 #4
0
 public void Setup()
 {
     tr               = Substitute.For <ITransponderReceiverClient>();
     log              = new CollisionLogger();//Substitute.For<ICollisionLogger>();
     uut              = new PlaneManager(tr, log);
     uut.PlaneNotify += EventHandler;
 }
コード例 #5
0
    public void Shoot(GameObject projectilePrefab, Vector3 firePoint, Quaternion direction, bool isChild = false, bool cameraShouldFollow = true, Transform target = null, int numItemsToDrop = -1, int dropArea = -1)
    {
        if (projectilePrefab != null)
        {
            go = Instantiate(projectilePrefab, firePoint, direction);

            if (isChild)
            {
                go.transform.parent = weapon.transform;
            }
            if (cameraShouldFollow)                         //Don't follow the sniper or shotgun or melee weapons
            {
                playerSettings.gameManager.projectile = go; //Tell GM what projectile is  in the game, to tell the camera to follow it
            }

            //Specific targeting info for some prefabs like plane and homing bazooka
            if (target != null)
            {
                PlaneManager pm = go.GetComponent <PlaneManager>();
                if (pm != null)
                {
                    pm.GM = playerSettings.gameManager;
                    pm.SetTarget(target.position, numItemsToDrop, dropArea);
                    return;
                }
                HomingBomb hb = go.GetComponent <HomingBomb>();
                if (hb != null)
                {
                    hb.target = target.position;
                    return;
                }
            }
        }
    }
        //---------------------------------------------------------------------------------------------
        //---------------------------------------------------------------------------------------------
        //Преобразовать точки к окружности
        private Point2D[] GetTransformedPoints(params Point2D[] points2D)
        {
            //this.EllipsePoints = points2D;

            EllipseApproximator ellipseApproximator = new EllipseApproximator();
            EllipseDescriptor   ellipseDescriptor   = ellipseApproximator.Approximate(points2D);

            Point2D ellipseCentre = ellipseDescriptor.GetCentre();

            points2D = PlaneManager.DisplacePoints(points2D, -ellipseCentre.X, -ellipseCentre.Y);

            double rotationAngle =
                ellipseDescriptor.GetAngleBetweenOxAndPrincipalAxis();

            points2D = this.RotatePoints(-rotationAngle, points2D);
            EllipseOrientaion pointsOrientation = this.GetPointsOrientation(points2D);

            if (pointsOrientation == EllipseOrientaion.AxisY)
            {
                points2D = this.RotatePoints(Math.PI / 2, points2D);
            }

            double radiusX = ellipseDescriptor.GetSemiMajorAxis();
            double radiusY = ellipseDescriptor.GetSemiMinorAxis();

            double stretchCoefficient = radiusX / radiusY;

            Point2D[] stretchPoints = this.StretchPointsAlongAxisY(stretchCoefficient, points2D);

            this.EllipsePoints = stretchPoints;
            return(stretchPoints);
        }
コード例 #7
0
 void Awake()
 {
     planeManager       = transform.parent.parent.GetChild(1).GetComponent <PlaneManager>();
     slotScript         = transform.parent.parent.GetComponent <SlotScript>();
     imageSlotExtractor = transform.parent.parent.
                          parent.GetComponent <ImageSlotExtractor>();
 }
        //---------------------------------------------------------------------------------------------
        //---------------------------------------------------------------------------------------------
        public InterferogramDecodingResult DecodeInterferogram(
            BitMask2D bitMask, params RealMatrix[] interferograms
            )
        {
            //Выбранные точки изображения
            Point[] selectedImagePoints = bitMask.GetTruePoints();

            double[] phaseShifts = this.GetRandomPhaseShifts(interferograms.Length);
            GenericInterferogramDecoder genericInterferogramDecoder = new GenericInterferogramDecoder();

            double[] numerators = genericInterferogramDecoder.GetDecodingFormulaNumerators
                                      (interferograms, phaseShifts, bitMask);
            double[] denominators = genericInterferogramDecoder.GetDecodingFormulaDenominators
                                        (interferograms, phaseShifts, bitMask);

            Point2D[] points2D = PlaneManager.CreatePoints2D(numerators, denominators);

            if (this.ExecutePointsCorrecting)
            {
                points2D = this.GetTransformedPoints(points2D);
            }
            int        sizeX        = interferograms[0].ColumnCount;
            int        sizeY        = interferograms[0].RowCount;
            RealMatrix resultMatrix =
                this.CalculatePhaseMatrix(points2D, selectedImagePoints, sizeX, sizeY);
            InterferogramDecodingResult decodingResult = new InterferogramDecodingResult(resultMatrix);

            return(decodingResult);
        }
コード例 #9
0
        //---------------------------------------------------------------------------------------------
        public InterferogramDecodingResult DecodeInterferogram(
            BitMask2D bitMask, params RealMatrix[] interferograms
            )
        {
            //Выбранные точки изображения
            Point[] selectedImagePoints = bitMask.GetTruePoints();

            //3D точки в плоскости, параллельной плоскости XY
            Point3D[] points3D =
                this.GetParallelToCoordinatePlanePoints3D(interferograms, selectedImagePoints);

            Point2D[] points2D = SpaceManager.GetProjectionXY(points3D);
            this.ProjectionPoints = points2D;
            points2D = PlaneManager.DisplacePointsToFirstQuadrant(points2D);

            Point2D[] transformedPoints = this.GetTransformedPoints(points2D);
            int       sizeX             = interferograms[0].ColumnCount;
            int       sizeY             = interferograms[0].RowCount;

            RealMatrix phaseMatrix =
                this.CalculatePhaseMatrix(transformedPoints, selectedImagePoints, sizeX, sizeY);

            InterferogramDecodingResult decodingResult = new InterferogramDecodingResult(phaseMatrix);

            return(decodingResult);
        }
コード例 #10
0
 // Start is called before the first frame update
 void Start()
 {
     Instance       = this;
     mPlanes        = new List <ARPlane>();
     mARPlaneManger = this.GetComponent <ARPlaneManager>();
     mARPlaneManger.planesChanged += OnPlaneChanged;
 }
コード例 #11
0
        //-------------------------------------------------------------------------------------------
        //-------------------------------------------------------------------------------------------
        public double[] Compute(
            Point pointOne,
            Point pointTwo,
            int interferogramIndexOne,
            int interferogramIndexTwo
            )
        {
            TrajectoryCreator trajectoryCreator = new TrajectoryCreator(this.interferograms);
            Curve2D           trajectory        = trajectoryCreator.GetTrajectory(pointOne, pointTwo);

            Point2D[] points = trajectory.GetPoints();
            this.TrajectoryPoints = points;
            EllipseApproximator ellipseApproximator = new EllipseApproximator();
            EllipseDescriptor   ellipseDescriptor   = ellipseApproximator.Approximate(points);
            Point2D             ellipseCentre       = ellipseDescriptor.GetCentre();

            points = PlaneManager.DisplacePoints(points, -ellipseCentre.X, -ellipseCentre.Y);

            double x0 = points[0].X;
            double y0 = points[0].Y;
            double x1 = points[interferogramIndexOne].X;
            double y1 = points[interferogramIndexOne].Y;
            double x2 = points[interferogramIndexTwo].X;
            double y2 = points[interferogramIndexTwo].Y;

            double[] phaseShifts = this.GetPhaseShifts(x0, y0, x1, y1, x2, y2);
            return(phaseShifts);
        }
コード例 #12
0
 // find other managers
 void Start()
 {
     UnitMan = (UnitManager)GameObject.FindObjectOfType(typeof(UnitManager));
     PlayerMan = (PlayerManager)GameObject.FindObjectOfType(typeof(PlayerManager));
     TileMan = (TileManager)GameObject.FindObjectOfType(typeof(TileManager));
     PlaneMan = (PlaneManager)GameObject.FindObjectOfType(typeof(PlaneManager));
     FragMan = (FragmentManager)GameObject.FindObjectOfType(typeof(FragmentManager));
 }
コード例 #13
0
        public void Update()
        {
            Time.timeScale = speedAnimation;

            if (lastTimeWagon <= Time.time)
            {
                lastTimeWagon = Time.time + delayWagon;
                int        indexWagon    = GetIndexWagon();
                GameObject prefabTrack   = resourceM.GetPrefab("Фура");
                Vector3    positionTrack = prefabTrack.transform.localPosition;
                Quaternion rotationTrack = prefabTrack.transform.localRotation;
                GameObject track         = Instantiate(prefabTrack, new Vector3(positionTrack.x - indexWagon * 3f, positionTrack.y, positionTrack.z), rotationTrack, trackContainer);
                approachingTracks.Add(indexWagon, track);

                float        liftWagonWeight = Random.Range(importedWeightMin, importedWeightMax);
                TrackManager trackM          = track.GetComponent <TrackManager>();
                trackM.indexParking = indexWagon;
                trackM.weight       = liftWagonWeight;
                StartCoroutine(TruckArrival(track));
            }

            if (lastTimePlane <= Time.time)
            {
                lastTimePlane = Time.time + delayPlane;

                int indexPlane = GetIndexPlane();

                GameObject prefabPlane   = (Random.Range(0, 100) > 20) ? resourceM.GetPrefab("A320") : resourceM.GetPrefab("A310");
                Vector3    positionPlane = prefabPlane.transform.localPosition;
                Quaternion rotationPlane = prefabPlane.transform.localRotation;
                GameObject plane         = Instantiate(prefabPlane, new Vector3(positionPlane.x - indexPlane * 51f, positionPlane.y, positionPlane.z), rotationPlane, trackContainer);
                approachingPlanes.Add(indexPlane, plane);

                PlaneManager planeM = plane.GetComponent <PlaneManager>();
                planeM.indexParking = indexPlane;
                StartCoroutine(PlaneArrival(plane));
            }

            // Если есть свободные погрузчики РАЗГРУЗКИ
            if (currentLoadersFreeUnloading.Count > 0 && tracks.Count > 0)
            {
                for (int i = 0; i < currentLoadersFreeUnloading.Count; i++)
                {
                    StartCoroutine(GoToUnloading(currentLoadersFreeUnloading[i]));
                    currentLoadersFreeUnloading.RemoveAt(i);
                }
            }

            // Если есть свободные погрузчики ЗАГРУЗКИ
            if (currentLoadersFreeLoading.Count > 0 && planes.Count > 0 && totalStockWeight > 0)
            {
                for (int i = 0; i < currentLoadersFreeLoading.Count; i++)
                {
                    StartCoroutine(GoToStockUnloading(currentLoadersFreeLoading[i]));
                    currentLoadersFreeLoading.RemoveAt(i);
                }
            }
        }
        //---------------------------------------------------------------------------------------------
        public InterferogramDecodingResult DecodeInterferogram(RealMatrix[] interferograms, BitMask2D bitMask)
        {
            //double gamma = 2;
            //interferograms = MatricesManager.GetGammaCorrectedMatrices( gamma, interferograms );
            //interferograms = GetNormalizedMatrices( interferograms );

            //Выбранные точки изображения
            Point[]   selectedImagePoints = bitMask.GetTruePoints();
            Point3D[] points3D            =
                this.GetParallelToCoordinatePlanePoints3D(interferograms, selectedImagePoints);
            this.TrajectoryPoints = points3D;

            Point2D[] points2D = SpaceManager.GetProjectionXY(points3D);
            this.ProjectionPoints = points2D;

            EllipseDescriptor ellipseDescriptor = this.GetEllipseDescriptor(points2D);
            Point2D           ellipseCentre     = ellipseDescriptor.GetCentre();
            Point3D           pointsCentre      = new Point3D(ellipseCentre.X, ellipseCentre.Y, points3D[0].Z);

            RealVector cylinderGuidLine           = this.GetCylinderGuidLine(ellipseDescriptor);
            RealVector normalizedCylinderGuidLine = cylinderGuidLine.GetNormalizedVector();

            /*
             * this.CalculateCirclePointsDispersion( cylinderGuidLine, points3D, pointsCentre );
             * double cylinderGuidLineOptimalAngle = this.GetCylinderGuidLineOptimalAngle();
             * cylinderGuidLine = this.GetRotatedInPlaneCylinderGuidLine
             *  ( cylinderGuidLine, cylinderGuidLineOptimalAngle );
             */

            Point3D[] circlePoints = this.GetCirclePoints(points3D, normalizedCylinderGuidLine);
            this.CirclePoints = circlePoints;
            Point3D circlePointsCentre =
                this.GetCorrectedCirclePoint(pointsCentre, normalizedCylinderGuidLine);

            //Поворот точек
            RealMatrix rotationMatrix = this.GetRotationMatrix(circlePoints);

            //rotationMatrix.WriteToTextFile( @"d:\!!\RotationMatrix.txt" ); // debug

            Point3D[] rotatedCirclePoints = this.RotatePoints(circlePoints, rotationMatrix);
            this.RotatedCirclePoints = rotatedCirclePoints;

            Point3D rotatedCirclePointsCentre = PlaneManager.RotateVector
                                                    (new RealVector(circlePointsCentre), rotationMatrix).ToPoint3D();

            Point3D[] correctedPoints =
                this.DisplacePoints(rotatedCirclePoints, rotatedCirclePointsCentre);

            int sizeX = interferograms[0].ColumnCount;
            int sizeY = interferograms[0].RowCount;

            RealMatrix phaseMatrix = this.CalculatePhaseMatrixByCirclePoints
                                         (correctedPoints, selectedImagePoints, sizeX, sizeY);

            InterferogramDecodingResult decodingResult = new InterferogramDecodingResult(phaseMatrix);

            return(decodingResult);
        }
コード例 #15
0
 void Awake()
 {
     // Get camera, that is supposed to attach to
     // the plane, from processing camera container.
     camToBind = transform.parent.parent.parent.
                 GetChild(0).GetChild(transform.parent.GetSiblingIndex() / 2).
                 GetComponent <Camera>();
     planeManager = transform.parent.parent.GetComponent <PlaneManager>();
 }
コード例 #16
0
ファイル: GameloopManager.cs プロジェクト: pavelkouril/ld40
 private void Awake()
 {
     _airportManager   = GetComponent <AirportManager>();
     _planeManager     = GetComponent <PlaneManager>();
     _uiManager        = GetComponent <UiManager>();
     _daytimeManager   = GetComponent <DaytimeManager>();
     _passengerManager = GetComponent <PassengerManager>();
     _upgradeManager   = GetComponent <UpgradeManager>();
 }
コード例 #17
0
    private void Awake()
    {
        if (Instance != null)
        {
            Destroy(this);
        }

        Instance = this;
    }
コード例 #18
0
ファイル: Mover.cs プロジェクト: unitycoder/oscp-unity-client
 void Start()
 {
     cam      = Camera.main.gameObject;
     camTrans = Camera.main.transform;
     camMain  = Camera.main;
     timer    = 0;
     myGO     = this.gameObject;
     pm       = GameObject.FindGameObjectWithTag("Manager").GetComponent <PlaneManager>();
 }
        //---------------------------------------------------------------------------------------------
        //Поворот до оси X
        private Point2D[] RotatePoints(double angle, params Point2D[] points2D)
        {
            RealVector[] coordinatesVectors = PlaneManager.CreateVectorsFromPoints(points2D);
            RealMatrix   rotationMatrix     = PlaneManager.GetRotationMatrixAnticlockwise(angle);

            RealVector[] newCoordinatesVectors =
                PlaneManager.RotateVectros(coordinatesVectors, rotationMatrix);
            Point2D[] newPoints = PlaneManager.CreatePoints2DFromVectors(newCoordinatesVectors);
            return(newPoints);
        }
コード例 #20
0
ファイル: SpNb0511.cs プロジェクト: XaHDpE/pzl3d
        protected override void Awake()
        {
            base.Awake();

            CacheLeanComponents();
            ConfigLeanComponents();

            // _omt = GetComponent<OneMoreTimeScript>();
            _normalsButton = GameObject.FindWithTag("NormalsButton").GetComponent <Button>();
            _planeManager  = Instantiate(leanPlanePrefab, Vector3.zero, Quaternion.identity).GetComponent <PlaneManager>();
        }
コード例 #21
0
    void DeployPlane(GameObject prefab)
    {
        GLOBALS.GM.turnClock += (int)(GLOBALS.mapXMax / 100) + 5f;
        planeSpawnPoint       = new Vector3(GLOBALS.mapXMax + 30f, GLOBALS.mapYMax + 20f, 0);
        this.go                = Instantiate(prefab, planeSpawnPoint, Quaternion.identity);
        cam.soldier            = this.go;
        cam.shouldFollowTarget = true;
        cam.SetZoom(100f);
        PlaneManager pm = this.go.transform.GetComponent <PlaneManager>();

        pm.SetTarget(new Vector2((GLOBALS.mapXMax / 2) + Random.Range(-20f, 20f), Random.Range(15f, 40f)), (int)Random.Range(3, 6), (GLOBALS.mapXMax / 2) - (int)Random.Range(0f, 30f));
    }
コード例 #22
0
 private void Awake()
 {
     gameHander   = map.GetComponent <GameHandler>();
     deckBuilder  = map.GetComponent <DeckBuilder>();
     planeMan     = map.GetComponentInChildren <PlaneManager>();
     cardManager  = ui.GetComponent <CardManager>();
     settingsMenu = ui.GetComponent <SettingsMenu>();
     uiMan        = ui.GetComponent <UIManager>();
     gameHander.GetSetUpParts(camController, cardManager, settingsMenu, uiMan);
     settingsMenu.GetSetUpParts(gameHander, planeMan, camController);
     cardManager.GetSetUpParts(gameHander, deckBuilder);
 }
コード例 #23
0
    }//end func

    public PlaneManager SpawnPlane()
    {
        //create this plane in the world at this position, with no rotation
        GameObject plane = Instantiate(BRS_PlaneSpawn, planeStartPoint, Quaternion.identity); //do not set plane to be child of this object!

        plane.transform.LookAt(planeEndPoint);                                                //point plane towards endpoint
        //get plane manager
        PlaneManager planeManager = plane.GetComponent <PlaneManager>();

        planeManager.InitPlane(targetDropZone, planeCargo, planeFlightSpeed);
        return(planeManager);
    }
コード例 #24
0
        static void Main(string[] args)
        {
            TransponderReceiverFactory TransponderReceiverFactory = new TransponderReceiverFactory();
            ITransponderReceiver       TransponderReceiver        = TransponderReceiverFactory.CreateTransponderDataReceiver();
            IDataFormatter             DataFormatter             = new DataFormatter();
            ITransponderReceiverClient TransponderReceiverClient = new TransponderReceiverClient(TransponderReceiver, DataFormatter);
            ICollisionLogger           ColLog = new CollisionLogger();
            IPlaneManager PlaneManager        = new PlaneManager(TransponderReceiverClient, ColLog);
            ILogger       Logger  = new ConsoleLogger();
            Display       Display = new Display(PlaneManager, Logger);

            while (true)
            {
            }
        }
コード例 #25
0
        void CreatePlayer()
        {
            if (m_player != null)
            {
                DestroyPlayer();
            }

            PlaneManager planeManager = Services.Get <PlaneManager>();

            m_player = planeManager.InstantiatePlayer();

            m_player.PlayerDeathEvent += HandlePlayerDeathEvent;
            m_player.PlayerDyingEvent += HandlePlayerDyingEvent;
            m_player.PlayerScoreEvent += HandlePlayerScoreEvent;
        }
コード例 #26
0
 private void Awake()
 {
     _gameloopManager  = GetComponent <GameloopManager>();
     _daytimeManager   = GetComponent <DaytimeManager>();
     _planeManager     = GetComponent <PlaneManager>();
     _airportManager   = GetComponent <AirportManager>();
     _upgradeManager   = GetComponent <UpgradeManager>();
     _camera           = Camera.main;
     _cameraController = _camera.GetComponent <CameraController>();
     StoreCamera();
     _unlockButton.gameObject.SetActive(_cameraController.lockRotation);
     _lockButton.gameObject.SetActive(!_cameraController.lockRotation);
     _pathEffect    = new PathEffect(_pathTessellation);
     _preserveColor = _preserveAlphaPanel.color;
 }
コード例 #27
0
ファイル: PlaneManager.cs プロジェクト: yelimlim/Catan
    public static PlaneManager Instance()
    {
        if (_instance == null)
        {
            _instance = (PlaneManager)FindObjectOfType(typeof(PlaneManager));

            if (_instance == null)
            {
                GameObject singleton = new GameObject();
                _instance = singleton.AddComponent<PlaneManager>();
                singleton.name = "PlaneManagerContainer" + typeof(PlaneManager).ToString();

                DontDestroyOnLoad(singleton);
            }
        }

        return _instance;
    }
コード例 #28
0
    //gets a different random fragment basedon which plane the tile is on
    void RefreshFragment()
    {
        PlaneManager pm = PlaneManager.PM;

        GameObject p = transform.parent.gameObject;

        if (p == pm.HighPlane)
        {
            NextFrag = FragmentManager.FM.GetRandomFrag(FragmentManager.FM.UpperFrags);
        }
        else if (p == pm.MidPlane)
        {
            NextFrag = FragmentManager.FM.GetRandomFrag(FragmentManager.FM.MiddleFrags);
        }
        else if (p == pm.LowPlane)
        {
            NextFrag = FragmentManager.FM.GetRandomFrag(FragmentManager.FM.LowerFrags);
        }
    }
コード例 #29
0
 public void PlaneSetup(PlaneManager manager, Vector4 mapBorders, bool show, bool sound, int id, Destination[] newPossibleDestinations = null, bool startingPlane = false)
 {
     startID         = id;
     showFB          = show;
     AllowSound      = sound;
     planeMan        = manager;
     borders         = mapBorders;
     isStartingPlane = startingPlane;
     if (isStartingPlane)
     {
         SetUpStartingPlane(newPossibleDestinations);
     }
     else
     {
         directionFeedback.SetActive(false);
         movementFeedback.transform.parent = null;
         ShowMovementFeedback(show);
     }
     defaultPos = transform.position;
     defaultRot = transform.rotation;
 }
コード例 #30
0
        public void Initialize()
        {
            PlaneManager gamePreferences = Services.Get <PlaneManager>();

            int current = gamePreferences.GetCurrentPlaneId();

            Dictionary <string, PlayerPrefabItemList> prefabData = gamePreferences.GetPrefabData();

            foreach (var entry in prefabData)
            {
                var items = entry.Value.playerPrefabItems;
                for (int i = 0; i < items.Count; ++i)
                {
                    PlaneCard card = GameObject.Instantiate <PlaneCard>(m_cardPrefab);
                    card.transform.SetParent(m_grid.transform, false);
                    card.Initialize(entry.Value.Bundle, entry.Key, items[i].iconFile, items[i].id, current == items[i].id);
                    card.ClickedEvent += HandleCardClicked;
                }
            }

            m_justInitialized = true;
        }
コード例 #31
0
    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }

        Instance = this;

        timeForWeightProblem = Random.Range(minimumTimePerWeightProblem, maxSecondsPerWeightProblem);
        moreThanXAngle       = false;
        timePassed           = 0;

        gameOver = false;
        audioMixer.TransitionToSnapshots(new AudioMixerSnapshot[1] {
            audioMixer.FindSnapshot("Snapshot")
        }, new float[1] {
            1f
        }, 0f);

        if (!mainMenu)
        {
            int sceneIndex = Random.Range(0, possibleScenes.Length);

            GameObject sceneSelected = Instantiate(possibleScenes[sceneIndex], plane);
            sceneSelected.transform.localPosition = Vector3.zero;

            BoxComponent[] boxesComponents = sceneSelected.GetComponentsInChildren <BoxComponent>();

            boxes.Clear();

            for (int i = 0; i < boxesComponents.Length; i++)
            {
                boxes.Add(boxesComponents[i]);
                boxesComponents[i].parentTransform = plane;
            }
        }
    }