Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        public async Task <PlatformRead> Create(NewPlatform newPlatform)
        {
            var platform = newPlatform.ToPlatform();

            platform.Validate();
            var duplicatedPlatform = await _repository.GetPlatform(platform.Name);

            if (duplicatedPlatform != null)
            {
                throw new DuplicatedPlatformException(platform.Name);
            }

            await _repository.CreatePlatform(platform);

            return(new PlatformRead(platform));
        }
 void ribbon_NewPlatformClicked()
 {
     lock (multiBoard)
     {
         NewPlatform dlg = new NewPlatform(new SortedSet <int>(multiBoard.SelectedBoard.Layers.Select(x => (IEnumerable <int>)x.zMList).Aggregate((x, y) => Enumerable.Concat(x, y))));
         if (dlg.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         int zm = dlg.result;
         multiBoard.SelectedBoard.SelectedLayer.zMList.Add(zm);
         multiBoard.SelectedBoard.SelectedPlatform = zm;
         ribbon.SetLayers(multiBoard.SelectedBoard.Layers);
         ribbon.SetSelectedLayer(multiBoard.SelectedBoard.SelectedLayerIndex, multiBoard.SelectedBoard.SelectedPlatform, multiBoard.SelectedBoard.SelectedAllLayers, multiBoard.SelectedBoard.SelectedAllPlatforms);
     }
 }
Ejemplo n.º 3
0
    void OnCollisionEnter(Collision hit)
    {
        if(nothityet){
            Debug.Log ("Hit, going down");
            goingup = false;
            //make new platform

            speed = .2f;
            //newplatformpos = new Vector3(0, 0, 0);
            Quaternion platformRotation = transform.rotation;
            newplatformpos = generateplatform();
            //Debug.Log("2 New x pos is: " + newplatformpos.x + "New z pos is: " + newplatformpos.z);

            clone = Instantiate(level,newplatformpos, platformRotation)as GameObject;
            nothityet = false;
            newscript = clone.GetComponent<NewPlatform>();
            Vector3 newpos = new Vector3(0,0,0); //need to stay 7 away
            var pos = transform.position;
            var clonepos = clone.transform.position;

            float x, z;
            x = (pos.x - clonepos.x)*-1;
            z = (pos.z - clonepos.z)*-1;
            newpos.x = Mathf.Sin (Mathf.Atan2(x,z)) * 7 + pos.x;
            newpos.z = Mathf.Cos (Mathf.Atan2(x,z)) * 7 + pos.z;
            newpos.y = pos.y - 75;

            //Debug.Log (" x: " + z + " y: " + x);
            //Debug.Log (" atan2: " + Mathf.Atan2(x,z)*Mathf.Rad2Deg);
            //Debug.Log (" adding x: " + Mathf.Cos (Mathf.Atan2(x,z))*7 + " adding y: " + (Mathf.Sin (Mathf.Atan2(x,z)) * 7));
            //Debug.Log (" sin is " + Mathf.Sin (Mathf.Atan2(x,z)));

            origionalY= clonepos.y;
            newscript.updest = newpos;

            //newscript.speed -= .02f;

        }
    }
Ejemplo n.º 4
0
 // Update is called once per frame
 void Update()
 {
     if (platform == null)
     {
         platform = NewPlatform;
     }
     if (transform.position.y < generationPoint.position.y + 6)
     {
         newDistanceX = Random.Range(minX, maxX);
         maxY         = minY + 2.3f;
         do
         {
             newDistanceY = Random.Range(minY, maxY);
         } while (newDistanceY - minY < 1);
         minY = newDistanceY + height;
         transform.position = new Vector3(newDistanceX, newDistanceY, transform.position.z);
         NewPlatform        = Instantiate(platform, transform.position, transform.rotation);
         NewPlatform.name   = "Platform " + platformCounter;
         render             = NewPlatform.GetComponent <Renderer>();
         render.enabled     = true;
         chooseMaterial();
         platformCounter++;
     }
 }
        public async Task <ActionResult <PlatformRead> > CreatePlatform(NewPlatform platform)
        {
            var platformRead = await _platformService.Create(platform);

            return(CreatedAtRoute(nameof(GetPlatform), new { platformRead.Id }, platformRead));
        }