Beispiel #1
0
        public override string GetItemType()
        {
            string artifactType = ArtifactType.ToString();

            if (ArtifactType.ToString().Contains("_"))
            {
                artifactType = artifactType.Replace("_", " ");
            }
            return(artifactType);
        }
 public void SetArtifactType(ArtifactType artifactType)
 {
     SetParamValue("artifactType", artifactType.ToString());
 }
Beispiel #3
0
    public void GenerateArtifacts(GameObject artifactCollided)
    {
        if (gm.gameState != GameManager.GameState.PLAY)
        {
            return;
        }


        float rand = Random.Range(artifactMinSpawnChance, artifactMaxSpawnChance);

        // First, we chack if we do a wall and if we are not in a serie
        if (serieToSpawn == 0 && rand < 50f)
        {
            if (artifactCollided.transform.childCount > 0)
            {
                artifactCollided.transform.GetChild(0).gameObject.GetComponent <ArtifactController>().Hide();
            }

            if (artifactCollided.name.ToUpper() == artifactType.ToString())
            {
                ++currentSpacesLength;
            }
            return;
        }

        if (serieToSpawn == 0 && artifactCollided.name.ToUpper() == artifactType.ToString())
        {
            ++currentSpacesLength;
        }

        // Determines then size of the artefact if not already done
        if (serieToSpawn == 0 && currentSpacesLength >= minSpaces + ((artifactType == ArtifactType.OUTER) ? 1 : 0))
        {
            // Determines what kind of artifact we are going to spawn
            artifactType = (artifactType == ArtifactType.INNER) ? ArtifactType.OUTER : ArtifactType.INNER;

            if (artifactType == ArtifactType.INNER)
            {
                serieToSpawn = Random.Range(1, 3);
            }
            else
            {
                serieToSpawn = Random.Range(1, 4);
            }

            ManageArtifact(artifactCollided);
            currentSpacesLength = 0;

            // Each new serie we increase the chance of artifacts
            artifactMinSpawnChance = Mathf.Clamp(artifactMinSpawnChance + 0.01f, 10, 40);
            artifactMaxSpawnChance = Mathf.Clamp(artifactMaxSpawnChance + 0.01f, 60, 90);
        }
        else
        {
            if (serieToSpawn > 0)
            {
                ManageArtifact(artifactCollided);
            }
            else
            {
                if (artifactCollided.transform.childCount > 0)
                {
                    artifactCollided.transform.GetChild(0).gameObject.GetComponent <ArtifactController>().Hide();
                }
            }
        }
    }
Beispiel #4
0
 protected override void OnValidate()
 {
     base.OnValidate();
     gameObject.name = ArtifactType.ToString() + " Slot";
 }
Beispiel #5
0
 private Sprite GetSpriteByArtifactType(ArtifactType artifactType)
 {
     return(Resources.Load <Sprite>("ArtifactSprites/" + artifactType.ToString()));
 }