コード例 #1
0
    //beaver beer
    //c**t cocktails
    //g-spot spirits
    //womb wiskey
    //vaginal vodka
    //crotch scotch
    //slit sake

    //cervix cider
    //fanny fruitwine
    //hymen
    //labia lager

    //ovarian absinthe
    //placenta
    //snatch
    //uterus tequila

    void Update()
    {
        if (this.isActive && base.isReady)
        {
            Ray ray = new Ray(this.transform.position, this.transform.forward);

            RaycastHit hit;

            //raycast first
            if (Physics.Raycast(ray, out hit, this.myRange, Bitwise.Off(1, 8)))
            {
                this.myTarget = hit.collider;
            }
            else
            {
                this.myTarget = null;

                float closest = float.MaxValue;

                foreach (var collider in UnityEngine.Object.FindObjectsOfType <Collider>())
                {
                    if (Logic <int> .Neither(collider.gameObject.layer, 1, 8))
                    {
                        float distance = Linear_Algebra.Distance_To_Collider(ray, collider, closest);

                        if (distance < closest)
                        {
                            closest       = distance;
                            this.myTarget = collider;
                        }
                    }
                }
            }
        }
    }
コード例 #2
0
ファイル: Ray_Spawner.cs プロジェクト: ipc0385/pleasework
    public override void Affect(params object[] argv)
    {
        RaycastHit hit;

        Ray ray = new Ray(this.transform.forward * this.myOffset + this.transform.position, this.transform.forward);

        if (Physics.Raycast(ray, out hit, this.myRange, Bitwise.Off(1, 8)))
        {
            Instantiate(this.mySpawn, hit.point, this.transform.rotation);
        }
        else
        {
            Instantiate(this.mySpawn, ray.origin + ray.direction * this.myRange, this.transform.rotation);
        }
    }