Ejemplo n.º 1
0
    void OnTriggerEnter(Collider col)
    {
        if (rigidbody.velocity.y < 0.01f)
        {
            PlatformBreakableController breakablePlatform = col.GetComponent <PlatformBreakableController>();
            if (breakablePlatform != null)
            {
                Destroy(breakablePlatform.gameObject);
            }
            else
            {
                PlatformController platformController = col.GetComponent <PlatformController>();
                if (platformController != null)
                {
                    rigidbody.velocity = new Vector3(0, _impulse, 0);
                    if (MusicManager.Instance != null)
                    {
                        MusicManager.Instance.PlayBallJumpSound();
                    }
                    Instantiate(particleSystem, transform.position, Quaternion.identity);
                }
            }
        }

        PlatformGridController platformGrid = col.gameObject.GetComponent <PlatformGridController>();

        if (platformGrid != null)
        {
            if (OnChangeScore != null && platformGrid.scoreToAdd > 0)
            {
                OnChangeScore(platformGrid.scoreToAdd);
            }
            platformGrid.scoreToAdd = 0;
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        for (int i = 0; i < particleSpawners.Length; i++)
        {
            particlegenerator = particleSpawners [i].GetComponent <ParticleGenerator> ();

            if (activated && rotating)                                                                                          //Lever is activated
            {
                particlegenerator.spawn = true;
                //transform.Rotate(new Vector3(0, 0, 50) * Time.deltaTime);
                StartCoroutine("RotateRight");
            }
            if (!activated && !rotating)                                                                                        //Lever is deactivated
            {
                particlegenerator.spawn = false;
                StartCoroutine("RotateLeft");
            }
        }
        for (int i = 0; i < movingPlatforms.Length; i++)
        {
            platformcontroller = movingPlatforms [i].GetComponent <PlatformController> ();

            if (activated)                                                                                      //Lever is activated
            {
                platformcontroller.platformActivator = false;
                transform.localRotation = Quaternion.Euler(0, 0, -327.2233f);
            }
            if (!activated)                                                                                     //Lever is deactivated
            {
                platformcontroller.platformActivator = true;
                transform.localRotation = Quaternion.Euler(0, 0, 327.2233f);
            }
        }
    }
Ejemplo n.º 3
0
        public void Put_WithMockedModel_ShouldBeCalledOnce()
        {
            // Arrange
            var actualId       = 4399;
            var dummyString    = Guid.NewGuid().ToString().Replace("-", "");
            var mockRepository = new Mock <IPlatformRepository>();
            var dbModel        = new PlatformModel()
            {
                Description = dummyString,
            };

            mockRepository
            .Setup(m => m.Update(dbModel));

            var controller = new PlatformController(mockRepository.Object);

            // Act
            controller.Put(actualId, dbModel);

            // Assert
            mockRepository
            .Verify(m => m.Update(
                        It.Is <PlatformModel>(
                            i => i.Id == actualId && i.Description == dummyString)),
                    Times.Once());
        }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        (gameObject.GetComponent("Halo") as Behaviour).enabled = false;
        GameObject         platform           = GameObject.Find("Platform");
        PlatformController platformController = platform.GetComponent <PlatformController>();

        layout = platformController.GetLayout();

        player = GameObject.Find("Player");
        for (i = 0; i < offset; i++)
        {
            path.Enqueue("Forward");
        }
        i = 0;

        /*       for (int i = 0; i < 7; i++)
         *         path.Enqueue("forward");
         *     path.Enqueue("right");
         *     for (int i = 0; i < 5; i++)
         *         path.Enqueue("forward");
         *     path.Enqueue("left");
         *     for (int i = 0; i < 2; i++)
         *         path.Enqueue("forward");
         *     path.Enqueue("right");*/
        //foreach (string str in path) {
        //    Debug.Log(str);
        //}
    }
Ejemplo n.º 5
0
        private static void StartUp()
        {
            var eventNotify = new EventNotify();

            try
            {
                var platform = new PlatformController();
                var sqlTools = new SqlConnectController(platform.GetSettingsFile());
                ReadConnect(sqlTools.SqlToolsConnects);
                var i = (int)GetConnect();
                if (sqlTools.SqlToolsConnects == null || i < 0 || sqlTools.SqlToolsConnects?.Connects.Count <= i)
                {
                    throw new Exception("Неверное значение!");
                }
                GetFunction(sqlTools.SqlToolsConnects?.Connects[i], platform);
            }
            catch (Exception e)
            {
                eventNotify.Error(MethodBase.GetCurrentMethod()?.ReflectedType?.Name, e);
            }
            finally
            {
                StartUp();
            }
        }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "DynamicObject" && collision.gameObject.layer == LayerMask.NameToLayer("Platform"))
        {
            this.transform.SetParent(collision.transform);

            currentPlatform = collision.GetComponent <PlatformController>();

            if (!currentPlatform)
            {
                return;
            }

            if (currentPlatform.CanRotate || currentPlatform.CanMove)
            {
            }

            //currentPlatform = collision.GetComponent<DynamicPlatform>();

            //if (!currentPlatform)
            //    return;

            //currentPlatform.platformBehaviourTriggered += FreezePlayerMovement;
            //currentPlatform.platformBehaviourEnded += UnFreezePlayerMovement;
        }
    }
Ejemplo n.º 7
0
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "Platform")
        {
            var platform = collision.gameObject.GetComponent <PlatformController>();
            switch (platform.state)
            {
            // Hitting a platform that's floating or sinking means the player is grounded
            case PlatformState.FLOATING:

            case PlatformState.SINKING:
                onPlatform = platform;
                isGrounded = true;
                break;
            }
        }

        if (collision.gameObject.tag == "Cup")
        {
            if (playerRigidbody.velocity.magnitude < 0.5f)
            {
                playerRigidbody.constraints = RigidbodyConstraints.None;
            }

            //playerRigidbody.constraints = RigidbodyConstraints.None;
        }
    }
Ejemplo n.º 8
0
    private IEnumerator ChangeMirrorPlatformSpeed(PlatformController platform, float speed, float interval)
    {
        yield return(new WaitForSeconds(PlatformInterval));

        platform.vSpeed = speed;
        platform.vDirectionChangeInterval = interval;
    }
Ejemplo n.º 9
0
        private static void GetFunction(SqlConnectProperty connect, PlatformController platform)
        {
            var countries = new Dictionary <int, string>(10)
            {
                { 1, "Загрузка шаблонов печати" }, { 2, "Создание шаблона печати" }
            };

            foreach (var(key, value) in countries)
            {
                Console.WriteLine($"{key}. {value}");
            }
            Console.Write("Value: ");
            switch (Convert.ToInt32(Console.ReadLine()))
            {
            case 1:
                TemplateReadAllController(connect, platform).Create();
                break;

            case 2:
                Console.Write("Имя документа: ");
                var fileName = Console.ReadLine();
                Console.Write("Код документа: ");
                var fileCode = Console.ReadLine();
                TemplateCreateController(fileName, fileCode, platform, connect).Create();
                break;

            default:
                throw new Exception("Неверное значение!");
            }
        }
Ejemplo n.º 10
0
        public override void Load(FileReader stream)
        {
            base.Load(stream);

            Controller   = (PlatformController)stream.ReadByte();
            StartingStep = stream.ReadByte();
        }
    private void OnCollisionEnter2D(Collision2D other)
    {
        //print("HIT");
        GameObject otherGO = other.gameObject;

        if (playerCollision == null)
        {
            print("**NULL**");
            return;
        }

        if (otherGO.tag == "Ground" && otherGO.GetComponent <PlatformController>() != null)
        {
            PlatformController platform = otherGO.GetComponent <PlatformController>();
            //print("Hit ground with color: " + platform.colors[platform.colorIndex]);

            if (colorState.ToString() != colors[platform.colorIndex].name && !playerCollision.isRoofHanging)
            {
                ChangeState(colors[platform.colorIndex].name);
                if (cameraShake != null)
                {
                    StartCoroutine(cameraShake.Shake(colorShakeDuration, colorShakeMagnitude));
                }
            }
        }
    }
        public void ShowGame_ReturnsCorrectView_True()
        {
            PlatformController controller = new PlatformController();
            ActionResult       thanksView = controller.ShowGame(9);

            Assert.IsInstanceOfType(thanksView, typeof(ViewResult));
        }
Ejemplo n.º 13
0
    void Start()
    {
        player = FindObjectOfType <Player>();

        foreach (GameObject sObject in FindGameObjectsWithTags(new string[] { "orangeDestroy", "coin" }))
        {
            stateObjects.Add(sObject);
        }

        foreach (GameObject dObject in GameObject.FindGameObjectsWithTag("dissPlatform"))
        {
            FallingPlatform fPlatform = dObject.GetComponent <FallingPlatform>();
            fallingPlatforms.Add(fPlatform);
        }

        foreach (GameObject pObject in FindGameObjectsWithTags(new string[] { "movingPlatform", "chaseBoss" }))
        {
            PlatformController pController = pObject.GetComponent <PlatformController>();
            platforms.Add(pController);
        }

        foreach (GameObject lObject in GameObject.FindGameObjectsWithTag("Lever"))
        {
            Lever lever = lObject.GetComponent <Lever>();
            levers.Add(lever);
        }
    }
Ejemplo n.º 14
0
    void Start()
    {
        // Locate the ball in the scene and store a reference to its BallController
        GameObject platform = GameObject.FindGameObjectWithTag("Platform");

        platformController = platform.GetComponent <PlatformController>();
    }
 void Awake()
 {
     _rb = GetComponent <Rigidbody>();
     _mr = GetComponent <MeshRenderer>();
     platformController = transform.parent.GetComponent <PlatformController>();
     _collider          = GetComponent <Collider>();
 }
Ejemplo n.º 16
0
    // Use this for initialization
    void Start()
    {
        // Set up the platform layout for the BallController class to access
        GameObject         platform           = GameObject.Find("Platform");
        PlatformController platformController = platform.GetComponent <PlatformController>();

        string[] layout    = platformController.GetLayout();
        int      rowNumber = 0;

        maxRow         = layout.Length;
        maxCol         = layout[0].Length;
        platformLayout = new Platform[layout.Length, layout[0].Length];

        foreach (string row in layout)
        {
            for (int col = 0; col < row.Length; col++)
            {
                if (row[col] == '*')
                {
                    platformLayout[rowNumber, col] = new Platform(rowNumber, col, true);
                }
                else
                {
                    platformLayout[rowNumber, col] = new Platform(rowNumber, col, false);
                }
            }
            rowNumber++;
        }

        // Initialize the variables that the ball should have at the beginning of the game
        //Note: for theDirection, 0 = North; 1 = East; 2 = South; 3 = West
        theDirection = 0;
        makeRight    = false;
        makeLeft     = false;
    }
Ejemplo n.º 17
0
    IEnumerator AlingPlatformsRoutine()
    {
        //gets initial x from the initial platform
        float   XPos = _initialPlatform.position.x;
        Vector2 newPos;

        //gets all the platforms and if it is conected(touching another platform), we set x to initial pos, maybe we can get this better saving all the platforms
        //in a array when the gets instantiate and delete it when it is destroy maybe can be more faster on running, but will occupe more RAM so we need more testing,
        //so far it goes well on mi phone
        for (int n = 0; n < _piecesParent.childCount; n++)
        {
            PlatformController platform = _piecesParent.GetChild(n).GetComponent <PlatformController>();

            if (platform.isConnected)
            {
                newPos   = platform.transform.position;
                newPos.x = XPos;
                platform.transform.position = newPos;
            }

            yield return(new WaitForEndOfFrame());
        }
        //set pos of player
        newPos   = _player.transform.position;
        newPos.x = XPos;
        _player.transform.position = newPos;

        yield return(new WaitForEndOfFrame());
    }
Ejemplo n.º 18
0
    private void AddKitchen(int posIndex)
    {
        float spawnRange = pos[posIndex].z - spawnDistance;

        if (player.transform.position.z > spawnRange && kitchenCount < maximumKitchenCount)
        {
            KITCHEN_TYPES currentKitchenType = KITCHEN_TYPES.LEFT;

            // Determine if kitchen is lane obstacle
            if (!isTutorial && OBSTACLE_LEFT_KITCHENS.Length > 0 && OBSTACLE_RIGHT_KITCHENS.Length > 0 && Random.Range(0, 100) < 10)
            {
                currentKitchenType = posIndex == 0 ? KITCHEN_TYPES.OBSTACLE_LEFT : KITCHEN_TYPES.OBSTACLE_RIGHT;
            }
            else
            {
                currentKitchenType = posIndex == 0 ? KITCHEN_TYPES.LEFT : KITCHEN_TYPES.RIGHT;
            }

            // Set position of platform
            kitchen = ObjectPooler.Instance.SpawnFromPool(GetRandomKitchen(currentKitchenType), pos[posIndex], Quaternion.identity);
            // Check if platform spawned
            if (kitchen == null)
            {
                return;                    // Should never occur if pool size is larger than max
            }
            pos[posIndex].z += kitchen.transform.localScale.z * kitchenLength;

            kitchenComponent = kitchen.GetComponent <PlatformController>();
            kitchenComponent.OnObjectSpawn();
            kitchenComponent.onRemoveItem += RemoveOne;

            kitchenCount++;
        }
    }
Ejemplo n.º 19
0
 public void Setup()
 {
     _platformService    = A.Fake <IPlatformService>();
     _logger             = A.Fake <ILogger <PlatformController> >();
     _mapper             = A.Fake <IMapper>();
     _platformController = new PlatformController(_platformService, _logger, _mapper);
 }
Ejemplo n.º 20
0
    private void OnSceneGUI()
    {
        PlatformController p = target as PlatformController;

        p.position1 = Handles.PositionHandle(p.position1 + p.transform.position, Quaternion.identity) - p.transform.position;
        p.position2 = Handles.PositionHandle(p.position2 + p.transform.position, Quaternion.identity) - p.transform.position;
    }
Ejemplo n.º 21
0
        private static void ReadAll()
        {
            var eventNotify = new EventNotify();

            try
            {
                var platform = new PlatformController();
                var sqlTools = new SqlConnectController(platform.GetSettingsFile());
                if (sqlTools.SqlToolsConnects == null)
                {
                    return;
                }
                foreach (var connect in sqlTools.SqlToolsConnects.Connects)
                {
                    try
                    {
                        TemplateReadAllController(connect, platform).Create();
                        eventNotify.Select(connect.Name);
                    }
                    catch (Exception e)
                    {
                        eventNotify.Error(string.Concat(connect.Name, " ", MethodBase.GetCurrentMethod()?.ReflectedType?.Name), e);
                    }
                }
            }
            catch (Exception e)
            {
                eventNotify.Error(MethodBase.GetCurrentMethod()?.ReflectedType?.Name, e);
            }
        }
        public void Index_ReturnsCorrectView_True()
        {
            PlatformController controller = new PlatformController();
            ActionResult       indexView  = controller.Index();

            Assert.IsInstanceOfType(indexView, typeof(ViewResult));
        }
Ejemplo n.º 23
0
        public void Get_WithNoParameters_ShouldReturnList()
        {
            // Arrange
            var mockRepository = new Mock <IPlatformRepository>();
            var expectedValue  = new List <PlatformModel>()
            {
                new PlatformModel()
                {
                    Id          = 4400,
                    Description = "et"
                }
            };

            mockRepository
            .Setup(m => m.SelectList())
            .Returns(expectedValue);

            var controller = new PlatformController(mockRepository.Object);

            // Act
            var result      = controller.Get();
            var actualValue = (List <PlatformModel>)result.Value;

            // Assert
            CollectionAssert.AreEqual(expectedValue, actualValue);
        }
Ejemplo n.º 24
0
    /**
     * 初始化
     */
    public void InitFunction(GameObject building, Vector3 position, MainController.FormFactorSideType sides, float platLength, float platWidth, float platHeight, float eaveColumnHeight, float goldColumnHeight, float mainRidgeHeightOffset, float allJijaHeight, List <Vector3> topFloorBorderList, int roofType, bool isStair, float rotateAngle = 0)
    {
        this.building = building;
        this.building.transform.parent = building.transform;
        this.rotateAngle = rotateAngle;
        this.sides       = sides;

        platformCenter              = position;
        platform                    = new GameObject("platform");
        platform.transform.parent   = this.building.transform;
        platform.transform.position = platformCenter;

        bodyCenter            = platformCenter + (platHeight / 2.0f + eaveColumnHeight / 2.0f) * Vector3.up;
        body                  = new GameObject("body");
        body.transform.parent = this.building.transform;

        roof = new GameObject("roof");
        roof.transform.parent = this.building.transform;

        platformController = building.AddComponent <PlatformController>();
        bodyController     = building.AddComponent <BodyController>();
        roofController     = building.AddComponent <RoofController>();

        //入口位置
        //entraneIndexList.SetEntranceIndex(0);


        platformController.InitFunction(this, platWidth, platLength, platHeight, isStair, rotateAngle);
        bodyController.InitFunction(this, eaveColumnHeight, goldColumnHeight);
        roofController.InitFunction(this, bodyController.GetColumnStructTopPosList(bodyController.eaveCornerColumnList), topFloorBorderList, platWidth, eaveColumnHeight, mainRidgeHeightOffset, allJijaHeight, roofType);

        buildingHeight = Vector3.Distance(roofTopCenter, platformCenter) + platformController.platHeight / 2.0f;
    }
Ejemplo n.º 25
0
    public static PlatformController FindPlatformAt(Vector3Int pos)
    {
        var foundObjs = FindObjectsOfType <PlatformController>().Where(x =>
        {
            Vector2Int location = new Vector2Int(Mathf.RoundToInt(x.transform.position.x), Mathf.RoundToInt(x.transform.position.z));
            return(location == new Vector2Int(pos.x, pos.z));
        });

        if (foundObjs.Count() == 0)
        {
            return(null);
        }

        float minDistanceY            = 1000000;
        PlatformController ClosestObj = null;

        foundObjs.ToList().ForEach(x =>
        {
            var distanceY = Mathf.Abs(x.transform.position.y - pos.y);
            if (minDistanceY > distanceY)
            {
                ClosestObj   = x;
                minDistanceY = distanceY;
            }
        });



        return(ClosestObj);
    }
Ejemplo n.º 26
0
    public bool TrySpawnPlatform()
    {
        // Attempt to get a random platform
        PlatformController controller = ObjectPools[Random.Range(0, ObjectPools.Length)].Get();

        // If there are no objects left in the pool, return false
        if (controller == null)
        {
            return(false);
        }

        // Reset the platform
        controller.ResetPlatform();

        // Give it a random position relative to the end of the previous platform
        float X = SpawnOrigin.position.x + Random.Range(HorizontalRandomFactorMin, HorizontalRandomFactorMax);
        float Y = SpawnOrigin.position.y + Random.Range(VerticalRandomFactorMin, VerticalRandomFactorMax);

        // Ensure the platform spawns on-screen
        controller.transform.position = new Vector2(X, Mathf.Max(Mathf.Min(SpawnVerticalMax, Y), SpawnVerticalMin));

        // Update the SpawnOrigin for the next platform
        SpawnOrigin = controller.EndPosition;

        // Return success
        return(true);
    }
Ejemplo n.º 27
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Platform")
        {
            var platform = other.gameObject.GetComponent <PlatformController>();
            // Hitting a platform that's can be absorbed gives the player ammo and then disappears

            if (isAbsorbing && platform.state == PlatformState.ABSORBED)
            {
                Debug.Log("Absorbed a platform");
                ammoCount      = Mathf.Clamp(ammoCount + platform.ammoValue, ammoCount, ammoLimit);
                isAbsorbing    = false;
                targetPlatform = null;
                for (int i = 0; i < platform.ammoValue; i++)
                {
                    //ammoQueue.Enqueue(BulletManager.Instance().GetBullet());
                }
                UpdateAmmoHUD();
                Destroy(other.gameObject);
            }
            else
            {
                // apply knock-back on the player
            }
        }
    }
    void Start()
    {
        platformController = PlatformController.Instance;

        towers      = Towers.Instance;
        playerStats = PlayerStats.Instance;
    }
Ejemplo n.º 29
0
        public PlayerController(PlayerCharacter player, PlayerData playerData, PlayerControls controls,
                                ControlSettings settings, AbstractController[] controllers)
        {
            this.player     = player;
            this.playerData = playerData;
            this.controls   = controls;
            this.settings   = settings;

            aerialController   = (AerialController)controllers[PlayerCharacter.ControllerIndexes.Air];
            groundController   = (GroundController)controllers[PlayerCharacter.ControllerIndexes.Ground];
            platformController = (PlatformController)controllers[PlayerCharacter.ControllerIndexes.Platform];
            wallController     = (WallController)controllers[PlayerCharacter.ControllerIndexes.Wall];
            ladderController   = (LadderController)controllers[PlayerCharacter.ControllerIndexes.Ladder];

            // TODO: Make this class reloadable.
            // Create buffers.
            var accessor = Properties.Access();
            var grab     = accessor.GetFloat("player.grab.buffer");
            var ascend   = accessor.GetFloat("player.ascend.buffer");

            // Actual values for requiresHold on each buffer are set when control settings are applied.
            attackBuffer = new InputBuffer(false, controls.Attack);
            grabBuffer   = new InputBuffer(grab, false, controls.Grab);
            ascendBuffer = new InputBuffer(ascend, false, controls.Jump);
            ascendBuffer.RequiredChords = controls.Ascend;

            settings.ApplyEvent += OnApply;

            MessageSystem.Subscribe(this, CoreMessageTypes.Input, (messageType, data, dt) =>
            {
                ProcessInput((FullInputData)data, dt);
            });
        }
Ejemplo n.º 30
0
 protected virtual void Awake()
 {
     answerPicExample  = Resources.Load <AnswerPic>("Prefabs/AnswerPic");
     answerTextExample = Resources.Load <AnswerText>("Prefabs/AnswerText");
     platform          = FindObjectOfType <PlatformController>();
     answerAnchor      = GameObject.Find("Answers").transform;
     question          = UIController.GetMenu <GameMenu>().question;
 }
Ejemplo n.º 31
0
	void Start () {
        platformController = GetComponent<PlatformController>();

        globalWaypoints = new Vector3[localWaypoints.Length];
        for (int i = 0; i < localWaypoints.Length; i++) {
            globalWaypoints[i] = localWaypoints[i] + transform.position;
        }
    }
    // Use this for initialization
    void Start()
    {
        parentPlatform = transform.parent.GetComponent<PlatformController>();
        parentPlatformID = parentPlatform.gameObject.GetInstanceID();

        if (buildingType == "silo") {
            buildQueue = new GameObject[buildQueueMax];
            buildQueue[0] = baseProjectilePrefab;
        } else if (buildingType == "generator") {
            powered = true;
        }

        parentPlatform.ChangeMaxShield(shieldMaxAmount);

        Vector4 materialCenter = transform.position;
        materialCenter.z = 0;

        GetComponent<Renderer>().material.SetVector("_Center", materialCenter);
    }
        private void doPlatformSummary()
        {
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            btnActivityLogs.Enabled = false;
            ConsoleRequest cr = new ConsoleRequest ();
            string json, encodedJSON, url, resp;
            ConsoleResponseDTO dto;
            try {
                cr.requestType = ConsoleRequest.PLATFORM_SUMMARY_COMPANY;
                cr.appID = 1;
                cr.companyID = company.companyID;

                json = JsonConvert.SerializeObject (cr);
                encodedJSON = HttpUtility.UrlEncode (json);
                url = Tools.CONSOLE_URL + encodedJSON;
                resp = TalkToServer.getData (url);
                dto = (ConsoleResponseDTO)JsonConvert.DeserializeObject (resp, typeof(ConsoleResponseDTO));
                List<PlatformSummaryDTO> sList = dto.platformSummaries;

                var contx = new PlatformController (sList, company.companyID);
                this.NavigationController.PushViewController (contx, true);
            } catch (System.Net.WebException ex) {
                Console.WriteLine ("Server unavailable: " + ex.Message);
                new UIAlertView ("Server Error", "Server not available", null, "OK").Show ();
            } catch (Exception ex) {
                Console.WriteLine ("Network unavailable: " + ex.Message);
                new UIAlertView ("Network Error", "Network not available", null, "OK").Show ();
            }
            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
            btnActivityLogs.Enabled = true;
        }
Ejemplo n.º 34
0
	void Start () {
        platformController = GetComponent<PlatformController>();
        currentVelocity = velocity;
	}
 public void RequestPlatformRetarget(PlatformController platform)
 {
     targetPlatform = platform;
 }
    public void RetargetPlatform()
    {
        GameObject[] platforms;
        GameObject newTargetPlatform = null;
        int randomSelector = 0;

        platforms = GameObject.FindGameObjectsWithTag("platform");

        if (platforms.Length > 1) {
            while(!newTargetPlatform) {
                randomSelector = Random.Range(0, platforms.Length);

                if (gameObject.GetInstanceID() != platforms[randomSelector].GetInstanceID()) {
                    newTargetPlatform = platforms[randomSelector];
                }
            }

            targetPlatform = newTargetPlatform.GetComponent<PlatformController>();
        } else {
            lastPlatform = true;
        }
    }
Ejemplo n.º 37
0
    // Use this for initialization
    void Start()
    {
        parentPlatform = transform.parent.GetComponent<PlatformController>();

        spriteRenderer.sprite = tileSprites[(int)Mathf.Floor(Random.Range(0f, 2.99f))];
    }
Ejemplo n.º 38
0
 // Use this for initialization
 void Awake()
 {
     if (mainPlayer == null) {
         DontDestroyOnLoad (gameObject);
         mainPlayer = this;
     } else if (mainPlayer!=this) {
         Destroy (gameObject);
     }
     gun = GetComponentInChildren<GunScript> ();
     ship = GetComponentInChildren<ShipController> ();
     platformer = GetComponentInChildren<PlatformController> ();
 }
 public void SetPlatform(PlatformController platform)
 {
     parentPlatform = platform;
 }
Ejemplo n.º 40
0
 void InitializeAI(PlatformController ownedPlatform)
 {
     platform = ownedPlatform;
 }