コード例 #1
0
        static void Postfix(Projectile __instance, Vector3 ___destination, ref float ___ticksToImpact, Thing launcher, ref Vector3 ___origin, LocalTargetInfo usedTarget, LocalTargetInfo intendedTarget, ProjectileHitFlags hitFlags, Thing equipment, ThingDef targetCoverDef)
        {
            GunPropDef prop = GunplaySetup.GunProp(equipment);

            if (prop == null)
            {
                return;
            }

            CompGun comp = equipment.TryGetComp <CompGun>();

            if (comp != null)
            {
                float angle = (___destination - ___origin).AngleFlat() - (intendedTarget.CenterVector3 - ___origin).AngleFlat();
                comp.RotationOffset = (angle + 180) % 360 - 180;
            }

            if (launcher as Pawn != null)
            {
                ___origin += (___destination - ___origin).normalized * prop.barrelLength;
            }

            if (Gunplay.settings.enableTrails)
            {
                ProjectileTrail trail = GenSpawn.Spawn(prop.trail, ___origin.ToIntVec3(), launcher.Map, WipeMode.Vanish) as ProjectileTrail;
                trail.Initialize(__instance, ___destination, equipment);
            }
        }
コード例 #2
0
    void Awake()
    {
        S = this;

        // Store the linerenderer component in a field
        line = this.GetComponent <LineRenderer>();

        // Initalize fields
        pointsCount = 0;

        // Disable until needed
        line.enabled = false;

        // Set random line colors

        float r = Random.value;
        float g = Random.value;
        float b = Random.value;

        float r2 = Random.value;
        float g2 = Random.value;
        float b2 = Random.value;

        Color c1 = new Color(r, g, b);
        Color c2 = new Color(r2, g2, b2);

        line.SetColors(c1, c2);
    }
コード例 #3
0
	void Awake(){
		S = this;

		//store the linerenderer component in a field
		line = this.GetComponent<LineRenderer> ();
		//initialize fields
		pointsCount = 0;
		//disable unitl needed
		line.enabled = false;
	}
コード例 #4
0
    void Awake()
    {
        S = this;                 // S = ProjectileTrail trailobject in hieracy

        //store the linerenderer component in a field
        line = this.GetComponent <LineRenderer>();


        Color c1 = Color.yellow;
        Color c2 = Color.red;

        line.SetColors(c1, c2);
        pointsCount = 0;

        line.enabled = false;
    }
コード例 #5
0
    void Awake()
    {
        S = this;

        // Store the linerenderer component in a field
        line = this.GetComponent <LineRenderer>();

        // Initalize fields
        pointsCount = 0;

        // Disable until needed
        line.enabled = false;

        // Set line colors
        Color c1 = Color.yellow;
        Color c2 = Color.red;

        line.SetColors(c1, c2);
    }
コード例 #6
0
    void Awake()
    {
        S = this;

        // Store the linerenderer component in a field
        line = this.GetComponent<LineRenderer>();

        // Initalize fields
        pointsCount = 0;

        // Disable until needed
        line.enabled = false;

        // Set line colors
        Color c1 = Color.yellow;
        Color c2 = Color.red;

        line.SetColors(c1,c2);
    }