コード例 #1
0
ファイル: Laser.cs プロジェクト: aziegler/sandboxJam
    void OnTriggerEnter2D(Collider2D other)
    {
        FlowerFinder ff = other.GetComponent <FlowerFinder>();

        if (null != ff)
        {
            FlowerRoot flower = ff.Flower;

            if (GameManager.Instance.IsLaserKillFlower)
            {
                flower.Kill();
            }
        }
        else
        {
            Debug.LogWarning("Laser hit a no flower root stuff " + other.name);
        }
    }
コード例 #2
0
    public GameObject SpawnSpore(FlowerFinder parent, Transform t)
    {
        if (Level == 3)
        {
            return(null);
        }
        var scale = 1f;

        HasSpore = true;

        GameObject go = GameObject.Instantiate(SporePrefab);

        go.transform.parent = null;
        if (Random.value < 0.33)
        {
            go.transform.parent = Slot;
        }
        else if (Random.value > 0.33 && Random.value < 0.66)
        {
            scale = 1 / 1.5f;
            go.transform.parent = GameManager.Instance.Sky;
        }
        else
        {
            scale = 1 / 0.94f;
            go.transform.parent = GameManager.Instance.BackParallax;
        }
        go.transform.localScale = new Vector3(scale, scale, scale);


        go.transform.position         = t.position;
        go.transform.localScale       = new Vector3(scale, scale, scale);
        go.transform.localEulerAngles = new Vector3(0f, 0f, Random.Range(0f, 360f));
        go.GetComponent <Spore>().Init();
        go.GetComponent <Spore>().Level      = Level;
        go.GetComponent <Spore>().Flower     = this;
        go.GetComponent <Spore>().FlowerHead = parent;


        SporeCount++;
        return(go);
    }