예제 #1
0
    public void Update()
    {
        transform.position += direction * speed * Time.smoothDeltaTime;
        BlockShard shard = this.Detect <BlockShard>(extents, blockMAsk, startPosition);

        if (shard != null)
        {
            MarchingBehavior.Instance.GetComponent <AudioSource>().PlayOneShot(blockBreak);
            Destroy(shard.gameObject);
            Destroy(this.gameObject);
        }

        if (transform.position.z > 32)
        {
            Destroy(this.gameObject);
        }

        Walker walker = this.Detect <Walker>(extents, enemyMask);
        Tank   tank   = this.Detect <Tank>(extents, enemyMask);


        if (walker != null && !walker.Exploding)
        {
            walker.Explode();
            Destroy(this.gameObject);
        }

        if (tank != null)
        {
            tank.CauseProblem();
            Destroy(this.gameObject);
        }
    }