コード例 #1
0
    public override void Update(Technique tech, GameManager.UpdateData data, float value)
    {
        double charge = (tech.GetBlackboardData("charge") as double?) ?? 0.0;

        if (charge < minimumCharge)
        {
            tech.SetBlackboardData("charge", minimumCharge);
        }
        else if (charge < maximumCharge)
        {
            tech.SetBlackboardData("charge", charge + (chargeRate * data.deltaTime));
        }

        if (tech.owner.slideParticle != null)
        {
            tech.owner.slideParticle.enabled = true;
        }
        tech.owner.HandlePhysics(data, tech.owner.physicsBody.frictionCoefficients * frictionMultiplier);
    }
コード例 #2
0
    public override void Exit(Technique tech)
    {
        double  charge     = (tech.GetBlackboardData("charge") as double?) ?? 0.0;
        Vector3 jumpVector = tech.owner.aimDirection * ((float)charge * jumpMultiplier);

        tech.owner.physicsBody.AddVelocity(jumpVector);
        tech.owner.onLayer = 1;
        Transform rightFootAnchor = tech.owner.GetAnchor("FootR");
        Transform leftFootAnchor  = tech.owner.GetAnchor("FootL");
        Vector3   emitterPosition = (rightFootAnchor.position + leftFootAnchor.position) / 2f;

        float mult = ((float)charge * jumpMultiplier) / 15f;

        tech.CreateEmitter("launch", emitterPosition, Vector3.SignedAngle(Vector3.up, jumpVector, Vector3.forward))
        .Expand(mult)
        .Accelerate(mult);

        tech.SetBlackboardData("charge", 0f);
    }