예제 #1
0
파일: Bullet.cs 프로젝트: LeSphax/Bendight
    private void UpdatePositionAndRotation(float deltaTime)
    {
        Vector3?   nextPosition;
        Quaternion?nextRotation;

        trajectory = trajectory.NextPosition(deltaTime, transform.position, out nextPosition, out nextRotation);

        if (nextPosition != null)
        {
            transform.position = nextPosition.Value;
        }
        if (nextRotation != null)
        {
            transform.rotation = nextRotation.Value;
        }
    }
예제 #2
0
파일: Bullet.cs 프로젝트: LeSphax/Bendight
    public void Init(Vector3[] controlPoints, Team team, int instantiatorID)
    {
        this.team = team;
        GetComponent <Renderer>().material.color = team.Color();

        if (controlPoints.Length == 1)
        {
            trajectory = new StraightTrajectoryStrategy(controlPoints[0], speed);
        }
        else
        {
            trajectory = new CurvedTrajectoryState(controlPoints, speed);
        }

        if (PhotonNetwork.player.ID != instantiatorID)
        {
            UpdatePositionAndRotation(PlayersLatency.OneWayTripOtherPlayer());
        }
    }