Exemplo n.º 1
0
    void Update()
    {
        var deltaTime = TimeManager.DeltaTime;

        Angle += AngleSpeed * deltaTime;
        //rb.velocity = Mathfd.Direction(angle) * speed;
        transform.position += (Vector3)(Mathfd.Direction(Angle) * Speed * deltaTime);

        if (MoveAngleLink)
        {
            BodyAngle = Angle;
        }

        // ★臨時回転処理
        //transform.rotation = Quaternion.Euler(0, 0, bodyAngle + 90);
        //rb.MoveRotation(angle + 90);

        if (Acceleration > 0 && Speed < SpeedLimit)
        {
            Speed = Mathf.Min(Speed + Acceleration * deltaTime, SpeedLimit);
        }
        else if (Acceleration < 0 && Speed > SpeedLimit)
        {
            Speed = Mathf.Max(Speed + Acceleration * deltaTime, SpeedLimit);
        }

        if (AngleAcceleration > 0 && AngleSpeed < AngleSpeedLimit)
        {
            AngleSpeed = Mathf.Min(AngleSpeed + AngleAcceleration * deltaTime, AngleSpeedLimit);
        }
        else if (AngleAcceleration < 0 && AngleSpeed > AngleSpeedLimit)
        {
            AngleSpeed = Mathf.Max(AngleSpeed + AngleAcceleration * deltaTime, AngleSpeedLimit);
        }
    }
Exemplo n.º 2
0
    public StgAct FireR2(GameObject original, float lR, float lAngle, float sR, float speed, float sAngle)
    {
        StgAct clone = StgAct.ApparentInstantiate(original);

        clone.transform.position = transform.position + (Vector3)(lR * Mathfd.Direction(lAngle) + sR * Mathfd.Direction(sAngle));
        clone.Speed = speed;
        clone.Angle = sAngle;

        return(clone);
    }