Exemple #1
0
    public void SetProperties(PlatformProperties p, int blueprintIndex)
    {
        properties = p;

        _spriteRenderer.color = p.color;
        this.blueprintIndex   = blueprintIndex;
    }
Exemple #2
0
 ///GENMHASH:FC4CCB4833EA2DD311741B384FD9316F:8E288AFF39988D3B6818D60EB161D26B
 internal RegistryTaskRunImpl(IRegistryManager registryManager, RunInner runInner)
 {
     this.registryManager = registryManager;
     this.registriesInner = registryManager.Inner.Registries;
     this.platform        = new PlatformProperties();
     this.inner           = runInner;
 }
Exemple #3
0
    IEnumerator FallThrough(PlatformProperties p)
    {
        c.enabled = false;
        p.DisableCollider();
        yield return(new WaitForSeconds(0.2f));

        c.enabled = true;
        p.EnableCollider();
    }
Exemple #4
0
 private void CreatePlatforms(int nAudioClips)
 {
     for (int i = 0; i < nAudioClips; i++)
     {
         PlatformProperties properties = new PlatformProperties {
             clipIndex = i, color = colors[i % colors.Count]
         };
         _platformProperties.Add(properties);
     }
 }
Exemple #5
0
    void Awake()
    {
        properties = GetComponent <PlatformProperties> ();

        if (middleSection != null)
        {
            originalScale = middleSection.transform.localScale.x;
        }
        else
        {
            originalScale = 1;
        }
    }
    void CreatePlatformBoxColliders()
    {
        GameObject goBoxCollidersParent = new GameObject("Platform Colliders");

        goBoxCollidersParent.transform.parent = gameObject.transform;

        int   iCurrentPlatformCollisionID   = 0;
        float fShortPlatformsSizeScaler     = 0.25f;
        float fShortPlatformsPositionOffset = 0.25f;

        foreach (List <PlatformProperties> lConnections in m_lPlatformConnections)
        {
            // Increment Collision ID
            iCurrentPlatformCollisionID += 1;

            // Create GameObject
            GameObject goPlatformCollider = new GameObject("Platform Collider");
            goPlatformCollider.transform.parent = goBoxCollidersParent.transform;

            // Add Box Collider
            BoxCollider2D BCollider = goPlatformCollider.AddComponent <BoxCollider2D>();
            float         xSize     = LevelGrid.GetTileSize().x *lConnections.Count;
            float         ySize     = (lConnections[0].IsShort ? LevelGrid.GetTileSize().y *fShortPlatformsSizeScaler : LevelGrid.GetTileSize().y);
            BCollider.size = new Vector2(xSize, ySize);

            // Set Position
            PlatformProperties glFirstElement = lConnections[0];
            PlatformProperties glLastElement  = lConnections[lConnections.Count - 1];
            float xStartPosition = (m_PlatformsOnGrid[glFirstElement.X, glFirstElement.Y].PlatformObject.transform.position.x - (LevelGrid.GetTileSize().x * 0.5f));
            float xEndPosition   = (m_PlatformsOnGrid[glLastElement.X, glLastElement.Y].PlatformObject.transform.position.x + (LevelGrid.GetTileSize().x * 0.5f));
            float xPosition      = (xStartPosition + ((xEndPosition - xStartPosition) * 0.5f));
            float yPosition      = (m_PlatformsOnGrid[glFirstElement.X, glFirstElement.Y].PlatformObject.transform.position.y);
            if (lConnections[0].IsShort)
            {
                yPosition -= (LevelGrid.GetTileSize().y *fShortPlatformsPositionOffset);
            }
            goPlatformCollider.transform.position = new Vector3(xPosition, yPosition);

            // Add Individual Platform Informations to the GameObject
            PlatformInformationBridge PInfoBridge = goPlatformCollider.AddComponent <PlatformInformationBridge>();
            GameObject[] agoPlatforms             = new GameObject[lConnections.Count];
            for (int i = 0; i < lConnections.Count; ++i)
            {
                PlatformProperties GL = lConnections[i];
                agoPlatforms[i] = m_PlatformsOnGrid[GL.X, GL.Y].PlatformObject;
            }
            PInfoBridge.AddPlatformObjects(agoPlatforms, iCurrentPlatformCollisionID);
        }
    }
 /// <summary>
 /// The function that specifies a platform.
 /// </summary>
 /// <param name="platformProperties">The properties of the platform.</param>
 /// <return>The next stage of the container registry task definition.</return>
 RegistryTask.Definition.ITaskStepType RegistryTask.Definition.IPlatform.WithPlatform(PlatformProperties platformProperties)
 {
     return(this.WithPlatform(platformProperties));
 }
Exemple #8
0
 void Start()
 {
     _properties = transform.GetComponent <PlatformProperties>();
     _baseX      = transform.position.x;
 }
Exemple #9
0
 ///GENMHASH:A96A757C20452610FED7B4572BE4EF30:AD5446D69223665E80C77696FF8DD55F
 public RegistryTaskImpl WithPlatform(PlatformProperties platformProperties)
 {
     this.inner.Platform = platformProperties;
     return(this);
 }
Exemple #10
0
 private void Awake()
 {
     _platformProperties = transform.GetComponent <PlatformProperties>();
     _spriteRenderer     = transform.GetComponent <SpriteRenderer>();
 }
Exemple #11
0
 /// <summary>
 /// The function that specifies the platform properties of the registry task run.
 /// </summary>
 /// <param name="platformProperties">The properties of the platform.</param>
 /// <return>The next stage of the container registry task run definition.</return>
 RegistryTaskRun.Definition.IRunRequestType RegistryTaskRun.Definition.IPlatform.WithPlatform(PlatformProperties platformProperties)
 {
     return(this.WithPlatform(platformProperties));
 }
Exemple #12
0
    void Spawner(Vector3 spawnOrigin)
    {
        //See if difficulty should increase
        if (currentDifficultyIndex < difficulties.Length - 1)
        {
            if (tipScore > difficulties[currentDifficultyIndex + 1].scoreUntilTrigger)
            {
                currentDifficultyIndex++;
                platformMoveSpeed = difficulties[currentDifficultyIndex].moveSpeed;
            }
        }

        Vector3 spawnLocation = new Vector3(0, spawnOrigin.y);

        for (int i = 0; i < difficulties[currentDifficultyIndex].platformCount; i++)
        {
            spawnLocation = new Vector3(Random.Range(screenLeft, screenRight), spawnLocation.y + Random.Range(difficulties[currentDifficultyIndex].spawnMin, difficulties[currentDifficultyIndex].spawnMax));
            GameObject         ins = Instantiate(platformPrefab, spawnLocation, Quaternion.identity, GameObject.Find("Platforms").transform);
            PlatformProperties pp  = ins.GetComponent <PlatformProperties>();
            //Spawn Color
            int r = Random.Range(0, 100);
            if (r < difficulties[currentDifficultyIndex].colorPercentage)
            {
                r = Random.Range(0, difficulties[currentDifficultyIndex].colorPercentage - 1);
                Color pColor = colors[r / (difficulties[currentDifficultyIndex].colorPercentage / colors.Length)];
                pp.platformColor = pColor;
                ins.GetComponentInChildren <SpriteRenderer>().color = new Color(pColor.r, pColor.g, pColor.b, 1f);
            }
            if (i == difficulties[currentDifficultyIndex].platformCount - 1)
            {
                topPlatformPos = ins.transform.position;
            }

            r = Random.Range(0, 100);

            //Spawn Moving
            if (r < difficulties[currentDifficultyIndex].movePercentage)
            {
                pp.isMove = true;
            }

            r = Random.Range(0, 100);

            //Star
            if (r < difficulties[currentDifficultyIndex].starPercentage)
            {
                spawnLocation = new Vector3(Random.Range(screenLeft, screenRight), spawnLocation.y + Random.Range(difficulties[currentDifficultyIndex].spawnMin, difficulties[currentDifficultyIndex].spawnMax));
                Instantiate(starPrefab, spawnLocation, Quaternion.identity, this.gameObject.transform);
            }

            r = Random.Range(0, 100);

            //Cracked
            if (r < difficulties[currentDifficultyIndex].crackedPercentage)
            {
                pp.isCracked = true;
            }
        }

        spawnIterationCount++;
    }