Exemplo n.º 1
0
    private void CompareSpawnedPosition(Transform checkedTransform, out FernIgnore ignoredAxis, out float ignoredSign)
    {
        Vector3 positionToCheck = checkedTransform.position;

        if (positionToCheck.x > maxBounds.x)
        {
            ignoredAxis = FernIgnore.ignoreX;
            ignoredSign = 1;
            return;
        }
        if (positionToCheck.x < minBounds.x)
        {
            ignoredAxis = FernIgnore.ignoreX;
            ignoredSign = -1;
            return;
        }
        if (positionToCheck.y > maxBounds.y)
        {
            ignoredAxis = FernIgnore.ignoreY;
            ignoredSign = 1;
            return;
        }
        if (positionToCheck.y < minBounds.y)
        {
            ignoredAxis = FernIgnore.ignoreY;
            ignoredSign = -1;
            return;
        }
        else
        {
            Debug.Log("Compare spawned pos :: error");
            ignoredAxis = FernIgnore.ignoreX;
            ignoredSign = 1;
        }
    }
Exemplo n.º 2
0
 public void Init(SpawnerController currentSpawner, FernIgnore ignoredAxis, float ignoredSign)
 {
     this.ignoredSign   = 1;
     this.ignoredSign  *= Mathf.Sign(ignoredSign);
     this.ignoredAxis   = ignoredAxis;
     spawningController = currentSpawner;
     SpawnFern();
     StartCoroutine(DisableSpawnPoint());
 }
Exemplo n.º 3
0
 public void Init(FernIgnore ignoredAxis, float ignoredSign, SpawnPoint owningSpawningPoint)
 {
     hasSpawned       = false;
     isDead           = false;
     spawningPoint    = owningSpawningPoint;
     ignoredAxisSign  = 1;
     ignoredAxisSign *= (int)Mathf.Sign(ignoredSign);
     ignoredSpawnAxis = ignoredAxis;
     health           = 0.1f;
 }
Exemplo n.º 4
0
    private void CreateSpawner(Transform spawnTransform)
    {
        FernIgnore ignoredAxis = FernIgnore.ignoreX;
        float      ignoredSign = 1;

        CompareSpawnedPosition(spawnTransform, out ignoredAxis, out ignoredSign);
        GameObject currentSpawner = Instantiate(plantObject, spawnTransform.position, Quaternion.identity, transform);

        spawners.Add(currentSpawner);
        currentSpawner.GetComponent <SpawnPoint>()?.Init(this, ignoredAxis, ignoredSign);
    }