Exemplo n.º 1
0
    private void PlaceRandomTile()
    {
        Vector3 pos = Vector3.zero;

        if (definedSpots.Length > 0)
        {
            pos = definedSpots[Random.Range(0, definedSpots.Length)].position;
        }
        else
        {
            var randX = Random.Range(-12, 0);
            var randY = Random.Range(-4, 4);

            pos = new Vector3(randX, randY, 0);
        }

        var t = Instantiate(prefabTileToAppear, pos, Quaternion.identity, transform);

        if (IsOccupiedPosition(t.transform.position))
        {
            Destroy(t);
            nextMoveTime = Time.time;
            return;
        }

        TriggerProjectile tProj = t.GetComponent <TriggerProjectile>();

        tProj.moveSpeed = 5f;

        Destroy(t, Random.Range(keepAliveRange.minValue, keepAliveRange.maxValue));
    }
Exemplo n.º 2
0
 private void Awake()
 {
     triggerProjectile = GetComponent <TriggerProjectile>();
 }